Changed combination to complex

This commit is contained in:
Kevin Frantz
2018-11-21 17:55:48 +01:00
parent 706a439b52
commit 999d17ad28
19 changed files with 29 additions and 29 deletions

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Entity\Source\Complex;
use App\Entity\Source\AbstractSource;
use Doctrine\ORM\Mapping as ORM;
/**
* @author kevinfrantz
*
* @ORM\Entity
* @ORM\Table(name="source_combination")
* @ORM\InheritanceType("JOINED")
* @ORM\DiscriminatorColumn(name="discr", type="string")
* @ORM\DiscriminatorMap({"user" = "UserSource","fullpersonname" = "FullPersonNameSource","personidentitysource"="PersonIdentitySource","fullpersonnamesource"="FullPersonNameSource"})
*/
abstract class AbstractCombinationSource extends AbstractSource implements CombinationSourceInterface
{
}

View File

@@ -0,0 +1,9 @@
<?php
namespace App\Entity\Source\Complex;
use App\Entity\Source\Primitive\DataSourceInterface;
interface CombinationSourceInterface extends DataSourceInterface
{
}

View File

@@ -0,0 +1,44 @@
<?php
namespace App\Entity\Source\Complex;
use App\Entity\Attribut\FirstNameSourceAttribut;
use App\Entity\Attribut\SurnameSourceAttribut;
use App\Entity\Source\Primitive\Name\SurnameSource;
use App\Entity\Source\Primitive\Name\FirstNameSource;
use Doctrine\ORM\Mapping as ORM;
use App\Entity\Source\Primitive\Name\SurnameSourceInterface;
use App\Entity\Source\Primitive\Name\FirstNameSourceInterface;
/**
* @author kevinfrantz
* @ORM\Table(name="source_combination_fullpersonname")
* @ORM\Entity()
*/
class FullPersonNameSource extends AbstractCombinationSource implements FullPersonNameSourceInterface
{
use FirstNameSourceAttribut,SurnameSourceAttribut;
/**
* @ORM\OneToOne(targetEntity="App\Entity\Source\Primitive\Name\SurnameSource",cascade={"persist", "remove"})
* @ORM\JoinColumn(name="surname_id", referencedColumnName="id",onDelete="CASCADE")
*
* @var SurnameSourceInterface
*/
protected $surnameSource;
/**
* @ORM\OneToOne(targetEntity="App\Entity\Source\Primitive\Name\FirstNameSource",cascade={"persist", "remove"})
* @ORM\JoinColumn(name="firstname_id", referencedColumnName="id",onDelete="CASCADE")
*
* @var FirstNameSourceInterface
*/
protected $firstNameSource;
public function __construct()
{
parent::__construct();
$this->surnameSource = new SurnameSource();
$this->firstNameSource = new FirstNameSource();
}
}

View File

@@ -0,0 +1,15 @@
<?php
namespace App\Entity\Source\Complex;
use App\Entity\Attribut\FirstNameSourceAttributInterface;
use App\Entity\Attribut\SurnameSourceAttributInterface;
/**
* @todo Maybe a middle name would be helpfull in the future ;)
*
* @author kevinfrantz
*/
interface FullPersonNameSourceInterface extends CombinationSourceInterface, FirstNameSourceAttributInterface, SurnameSourceAttributInterface
{
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Entity\Source\Complex;
use App\Entity\Attribut\FullPersonNameSourceAttribut;
use Doctrine\ORM\Mapping as ORM;
/**
* @author kevinfrantz
* @ORM\Table(name="source_combination_person_identity")
* @ORM\Entity()
*/
class PersonIdentitySource extends AbstractCombinationSource implements PersonIdentitySourceInterface
{
use FullPersonNameSourceAttribut;
/**
* @ORM\OneToOne(targetEntity="FullPersonNameSource",cascade={"persist", "remove"})
* @ORM\JoinColumn(name="fullname_id", referencedColumnName="id",onDelete="CASCADE")
*
* @var FullPersonNameSourceInterface
*/
protected $fullPersonNameSource;
public function __construct()
{
parent::__construct();
$this->fullPersonNameSource = new FullPersonNameSource();
}
}

View File

@@ -0,0 +1,9 @@
<?php
namespace App\Entity\Source\Complex;
use App\Entity\Attribut\FullPersonNameSourceAttributInterface;
interface PersonIdentitySourceInterface extends CombinationSourceInterface, FullPersonNameSourceAttributInterface
{
}

View File

@@ -0,0 +1,40 @@
<?php
namespace App\Entity\Source\Complex;
use Doctrine\ORM\Mapping as ORM;
use App\Entity\Attribut\UserAttribut;
use App\Entity\UserInterface;
use App\Entity\Attribut\PersonIdentitySourceAttribut;
/**
* @author kevinfrantz
* @ORM\Table(name="source_data_user")
* @ORM\Entity(repositoryClass="App\Repository\UserSourceRepository")
*/
class UserSource extends AbstractCombinationSource implements UserSourceInterface
{
use UserAttribut,PersonIdentitySourceAttribut;
/**
* @ORM\OneToOne(targetEntity="App\Entity\User",cascade={"persist", "remove"})
* @ORM\JoinColumn(name="user_id", referencedColumnName="id",onDelete="CASCADE")
*
* @var UserInterface
*/
protected $user;
/**
* @ORM\OneToOne(targetEntity="PersonIdentitySource",cascade={"persist", "remove"})
* @ORM\JoinColumn(name="identity_id", referencedColumnName="id",onDelete="CASCADE")
*
* @var PersonIdentitySourceInterface
*/
protected $personIdentitySource;
public function __construct()
{
$this->personIdentitySource = new PersonIdentitySource();
parent::__construct();
}
}

View File

@@ -0,0 +1,14 @@
<?php
namespace App\Entity\Source\Complex;
use App\Entity\Attribut\UserAttributInterface;
use App\Entity\Attribut\PersonIdentitySourceAttributInterface;
use App\Entity\Source\Primitive\DataSourceInterface;
/**
* @author kevinfrantz
*/
interface UserSourceInterface extends DataSourceInterface, UserAttributInterface, PersonIdentitySourceAttributInterface
{
}