diff --git a/application/src/Entity/Source/Combination/AbstractCombinationSource.php b/application/src/Entity/Source/Combination/AbstractCombinationSource.php index d79a818..0357cec 100644 --- a/application/src/Entity/Source/Combination/AbstractCombinationSource.php +++ b/application/src/Entity/Source/Combination/AbstractCombinationSource.php @@ -12,7 +12,7 @@ use Doctrine\ORM\Mapping as ORM; * @ORM\Table(name="source_combination") * @ORM\InheritanceType("JOINED") * @ORM\DiscriminatorColumn(name="discr", type="string") - * @ORM\DiscriminatorMap({"user" = "UserSource","fullpersonname" = "FullPersonNameSource","personidentitysource"="PersonIdentitySource"}) + * @ORM\DiscriminatorMap({"user" = "UserSource","fullpersonname" = "FullPersonNameSource","personidentitysource"="PersonIdentitySource","fullpersonnamesource"="FullPersonNameSource"}) */ abstract class AbstractCombinationSource extends AbstractSource implements CombinationSourceInterface { diff --git a/application/src/Entity/Source/Combination/FullPersonNameSource.php b/application/src/Entity/Source/Combination/FullPersonNameSource.php index f173374..a3d3a85 100644 --- a/application/src/Entity/Source/Combination/FullPersonNameSource.php +++ b/application/src/Entity/Source/Combination/FullPersonNameSource.php @@ -6,7 +6,13 @@ use App\Entity\Attribut\FirstNameSourceAttribut; use App\Entity\Attribut\SurnameSourceAttribut; use App\Entity\Source\Data\Name\SurnameSource; use App\Entity\Source\Data\Name\FirstNameSource; +use Doctrine\ORM\Mapping as ORM; +/** + * @author kevinfrantz + * @ORM\Table(name="source_combination_fullpersonname") + * @ORM\Entity() + */ class FullPersonNameSource extends AbstractCombinationSource implements FullPersonNameSourceInterface { use FirstNameSourceAttribut,SurnameSourceAttribut; diff --git a/application/src/Entity/Source/Combination/PersonIdentitySource.php b/application/src/Entity/Source/Combination/PersonIdentitySource.php index d35598e..ad512d5 100644 --- a/application/src/Entity/Source/Combination/PersonIdentitySource.php +++ b/application/src/Entity/Source/Combination/PersonIdentitySource.php @@ -15,6 +15,9 @@ class PersonIdentitySource extends AbstractCombinationSource implements PersonId use FullPersonNameSourceAttribut; /** + * @ORM\OneToOne(targetEntity="FullPersonNameSource",cascade={"persist", "remove"}) + * @ORM\JoinColumn(name="fullname_id", referencedColumnName="id",onDelete="CASCADE") + * * @var FullPersonNameSourceInterface */ protected $fullPersonNameSource; diff --git a/application/src/Entity/Source/Combination/UserSource.php b/application/src/Entity/Source/Combination/UserSource.php index 045c106..2d67516 100644 --- a/application/src/Entity/Source/Combination/UserSource.php +++ b/application/src/Entity/Source/Combination/UserSource.php @@ -26,6 +26,7 @@ class UserSource extends AbstractCombinationSource implements UserSourceInterfac /** * @ORM\OneToOne(targetEntity="PersonIdentitySource",cascade={"persist", "remove"}) + * @ORM\JoinColumn(name="identity_id", referencedColumnName="id",onDelete="CASCADE") * * @var PersonIdentitySourceInterface */ diff --git a/application/tests/Unit/Repository/UserRepositoryTest.php b/application/tests/Unit/Repository/UserRepositoryTest.php index cbf32e6..15ad890 100644 --- a/application/tests/Unit/Repository/UserRepositoryTest.php +++ b/application/tests/Unit/Repository/UserRepositoryTest.php @@ -52,6 +52,7 @@ class UserRepositoryTest extends KernelTestCase $this->assertEquals($userId, $this->loadedUser->getId()); $this->assertGreaterThan(0, $this->loadedUser->getSource()->getId()); $this->assertGreaterThan(0, $this->loadedUser->getSource()->getPersonIdentitySource()->getId()); + $this->assertGreaterThan(0, $this->loadedUser->getSource()->getPersonIdentitySource()->getFullPersonNameSource()->getId()); $this->deleteUser(); $this->assertNull($this->userRepository->find($userId)); $this->loadedUser = null;