Implemented fullpersonnamesource orm mapping

This commit is contained in:
Kevin Frantz 2018-11-18 12:25:36 +01:00
parent 08c4bee43f
commit 0c852dbec4
5 changed files with 12 additions and 1 deletions

View File

@ -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
{

View File

@ -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;

View File

@ -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;

View File

@ -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
*/

View File

@ -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;