Optimized entity mapping

This commit is contained in:
Kevin Frantz
2018-11-20 22:04:29 +01:00
parent 0c852dbec4
commit 3b1330c40f
10 changed files with 34 additions and 10 deletions

View File

@@ -7,6 +7,8 @@ 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;
use App\Entity\Source\Data\Name\SurnameSourceInterface;
use App\Entity\Source\Data\Name\FirstNameSourceInterface;
/**
* @author kevinfrantz
@@ -17,6 +19,22 @@ class FullPersonNameSource extends AbstractCombinationSource implements FullPers
{
use FirstNameSourceAttribut,SurnameSourceAttribut;
/**
* @ORM\OneToOne(targetEntity="App\Entity\Source\Data\Name\SurnameSource",cascade={"persist", "remove"})
* @ORM\JoinColumn(name="surname_id", referencedColumnName="id",onDelete="CASCADE")
*
* @var SurnameSourceInterface
*/
protected $surnameSource;
/**
* @ORM\OneToOne(targetEntity="App\Entity\Source\Data\Name\FirstNameSource",cascade={"persist", "remove"})
* @ORM\JoinColumn(name="firstname_id", referencedColumnName="id",onDelete="CASCADE")
*
* @var FirstNameSourceInterface
*/
protected $firstnNameSource;
public function __construct()
{
parent::__construct();

View File

@@ -16,7 +16,7 @@ use Symfony\Component\Validator\Constraints as Assert;
* @ORM\DiscriminatorColumn(name="discr", type="string")
* @ORM\DiscriminatorMap({"nickname" = "NicknameSource","firstname" = "FirstNameSource", "surname" = "SurnameSource"})
*/
abstract class AbstractNameSource extends AbstractDataSource implements NameSourceInterface
class AbstractNameSource extends AbstractDataSource implements NameSourceInterface
{
use NameAttribut;

View File

@@ -2,6 +2,12 @@
namespace App\Entity\Source\Data\Name;
final class FirstNameSource extends AbstractNameSource implements FirstNameSourceInterface
use Doctrine\ORM\Mapping as ORM;
/**
* @author kevinfrantz
* @ORM\Entity()
*/
class FirstNameSource extends AbstractNameSource implements FirstNameSourceInterface
{
}

View File

@@ -6,9 +6,8 @@ use Doctrine\ORM\Mapping as ORM;
/**
* @author kevinfrantz
* @ORM\Table(name="source_data_name_nickname")
* @ORM\Entity()
*/
final class NicknameSource extends AbstractNameSource implements NicknameSourceInterface
class NicknameSource extends AbstractNameSource implements NicknameSourceInterface
{
}

View File

@@ -6,9 +6,8 @@ use Doctrine\ORM\Mapping as ORM;
/**
* @author kevinfrantz
* @ORM\Table(name="source_data_name_surname")
* @ORM\Entity()
*/
final class SurnameSource extends AbstractNameSource implements SurnameSourceInterface
class SurnameSource extends AbstractNameSource implements SurnameSourceInterface
{
}

View File

@@ -14,7 +14,7 @@ use App\Exception\NotDefinedException;
*
* @todo move to the logic level!
*/
final class AndOperation extends AbstractOperation
class AndOperation extends AbstractOperation
{
public function process(): void
{