diff --git a/application/src/Entity/Attribut/PersonIdentityAttribut.php b/application/src/Entity/Attribut/PersonIdentitySourceAttribut.php similarity index 87% rename from application/src/Entity/Attribut/PersonIdentityAttribut.php rename to application/src/Entity/Attribut/PersonIdentitySourceAttribut.php index 933b546..12459ee 100644 --- a/application/src/Entity/Attribut/PersonIdentityAttribut.php +++ b/application/src/Entity/Attribut/PersonIdentitySourceAttribut.php @@ -1,10 +1,10 @@ surnameSource; + } + + public function setSurname(SurnameSourceInterface $name): void + { + $this->surnameSource = $name; + } } diff --git a/application/src/Entity/Attribut/SurnameSourceAttributInterface.php b/application/src/Entity/Attribut/SurnameSourceAttributInterface.php index e66d900..c7bbd5a 100644 --- a/application/src/Entity/Attribut/SurnameSourceAttributInterface.php +++ b/application/src/Entity/Attribut/SurnameSourceAttributInterface.php @@ -4,20 +4,9 @@ namespace App\Entity\Attribut; use App\Entity\Source\Data\Name\SurnameSourceInterface; -trait SurnameSourceAttribut +interface SurnameSourceAttributInterface { - /** - * @var SurnameSourceInterface - */ - protected $surnameSource; + public function getSurname(): SurnameSourceInterface; - public function getSurname(): SurnameSourceInterface - { - return $this->surnameSource; - } - - public function setSurname(SurnameSourceInterface $name): void - { - $this->surnameSource = $name; - } + public function setSurname(SurnameSourceInterface $name): void; } diff --git a/application/src/Entity/Source/Combination/UserSource.php b/application/src/Entity/Source/Combination/UserSource.php index d5d7efe..ca77af9 100644 --- a/application/src/Entity/Source/Combination/UserSource.php +++ b/application/src/Entity/Source/Combination/UserSource.php @@ -5,7 +5,7 @@ namespace App\Entity\Source\Combination; use Doctrine\ORM\Mapping as ORM; use App\Entity\Attribut\UserAttribut; use App\Entity\UserInterface; -use Entity\Attribut\PersonIdentityAttribut; +use App\Entity\Attribut\PersonIdentitySourceAttribut; /** * @author kevinfrantz @@ -14,7 +14,7 @@ use Entity\Attribut\PersonIdentityAttribut; */ class UserSource extends AbstractCombinationSource implements UserSourceInterface { - use UserAttribut,PersonIdentityAttribut; + use UserAttribut,PersonIdentitySourceAttribut; /** * @ORM\OneToOne(targetEntity="App\Entity\User",cascade={"persist", "remove"}) diff --git a/application/src/Entity/Source/Data/Name/AbstractNameSource.php b/application/src/Entity/Source/Data/Name/AbstractNameSource.php index 32c0180..8559f3f 100644 --- a/application/src/Entity/Source/Data/Name/AbstractNameSource.php +++ b/application/src/Entity/Source/Data/Name/AbstractNameSource.php @@ -5,6 +5,7 @@ namespace App\Entity\Source\Data\Name; use App\Entity\Source\Data\AbstractDataSource; use App\Entity\Attribut\NameAttribut; use Doctrine\ORM\Mapping as ORM; +use Symfony\Component\Validator\Constraints as Assert; /** * @author kevinfrantz @@ -13,9 +14,23 @@ use Doctrine\ORM\Mapping as ORM; * @ORM\Table(name="source_data_name") * @ORM\InheritanceType("SINGLE_TABLE") * @ORM\DiscriminatorColumn(name="discr", type="string") - * @ORM\DiscriminatorMap({"nickname" = "NicknameSource","firstname" = "FirstNameSource", "lastname" = "LastNameSource"}) + * @ORM\DiscriminatorMap({"nickname" = "NicknameSource","firstname" = "FirstNameSource", "surname" = "SurnameSource"}) */ abstract class AbstractNameSource extends AbstractDataSource implements NameSourceInterface { use NameAttribut; + + /** + * @todo Implement an extra assert Layer! - maybe ;) + * @ORM\Column(type="string",length=255) + * @Assert\NotBlank() + * + * @var string + */ + protected $name; + + public function __construct() + { + parent::__construct(); + } } diff --git a/application/src/Entity/Source/Data/Name/FirstNameSource.php b/application/src/Entity/Source/Data/Name/FirstNameSource.php new file mode 100644 index 0000000..6f252c3 --- /dev/null +++ b/application/src/Entity/Source/Data/Name/FirstNameSource.php @@ -0,0 +1,7 @@ +identity = new class() implements PersonIdentitySourceAttributInterface { - use PersonIdentityAttribut; + use PersonIdentitySourceAttribut; }; }