optimized orm structure

This commit is contained in:
Kevin Frantz 2018-11-23 22:34:44 +01:00
parent e16f2a44a8
commit 15ea900d74
11 changed files with 13 additions and 42 deletions

View File

@ -26,7 +26,19 @@ use Symfony\Component\Validator\Constraints as Assert;
* @ORM\Table(name="source")
* @ORM\InheritanceType("JOINED")
* @ORM\DiscriminatorColumn(name="discr", type="string")
* @ORM\DiscriminatorMap({"primitive" = "App\Entity\Source\Primitive\AbstractPrimitiveSource", "collection" = "App\Entity\Source\Complex\Collection\AbstractCollectionSource","operation"="App\Entity\Source\Operation\AbstractOperation"})
* @ORM\DiscriminatorMap({
* "text" = "App\Entity\Source\Primitive\Text\TextSource",
* "operation"="App\Entity\Source\Operation\AbstractOperation",
* "user" = "App\Entity\Source\Complex\UserSource",
* "fullpersonname" = "App\Entity\Source\Complex\FullPersonNameSource",
* "personidentitysource"="App\Entity\Source\Complex\PersonIdentitySource",
* "fullpersonnamesource"="App\Entity\Source\Complex\FullPersonNameSource",
* "member" = "App\Entity\Source\Complex\Collection\TreeCollectionSource",
* "and" = "App\Entity\Source\Operation\AndOperation",
* "nickname" = "App\Entity\Source\Primitive\Name\NicknameSource",
* "firstname" = "App\Entity\Source\Primitive\Name\FirstNameSource",
* "surname" = "App\Entity\Source\Primitive\Name\SurnameSource"
* })
* @UniqueEntity("slug",ignoreNull=true)
*/
abstract class AbstractSource extends AbstractEntity implements SourceInterface

View File

@ -3,16 +3,9 @@
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 AbstractComplexSource extends AbstractSource implements ComplexSourceInterface
{

View File

@ -10,12 +10,6 @@ use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity
* @ORM\Table(name="source_collection")
* @ORM\InheritanceType("JOINED")
* @ORM\DiscriminatorColumn(name="discr", type="string")
* @ORM\DiscriminatorMap({"member" = "TreeCollectionSource"})
*
* @author kevinfrantz
*/
abstract class AbstractCollectionSource extends AbstractSource implements CollectionSourceInterface

View File

@ -7,9 +7,6 @@ use App\Entity\Attribut\CollectionAttribut;
/**
* @author kevinfrantz
*
* @todo remove deprecated trait membersattribut
* @ORM\Table(name="source_group")
* @ORM\Entity
*/
class TreeCollectionSource extends AbstractCollectionSource implements TreeCollectionSourceInterface

View File

@ -12,7 +12,6 @@ use App\Entity\Source\Primitive\Name\FirstNameSourceInterface;
/**
* @author kevinfrantz
* @ORM\Table(name="source_combination_fullpersonname")
* @ORM\Entity()
*/
class FullPersonNameSource extends AbstractComplexSource implements FullPersonNameSourceInterface

View File

@ -7,7 +7,6 @@ use Doctrine\ORM\Mapping as ORM;
/**
* @author kevinfrantz
* @ORM\Table(name="source_combination_person_identity")
* @ORM\Entity()
*/
class PersonIdentitySource extends AbstractComplexSource implements PersonIdentitySourceInterface

View File

@ -9,7 +9,6 @@ use App\Entity\Attribut\PersonIdentitySourceAttribut;
/**
* @author kevinfrantz
* @ORM\Table(name="source_data_user")
* @ORM\Entity(repositoryClass="App\Repository\UserSourceRepository")
*/
class UserSource extends AbstractComplexSource implements UserSourceInterface

View File

@ -13,10 +13,6 @@ use App\Exception\NotProcessedException;
/**
* @author kevinfrantz
* @ORM\Entity
* @ORM\Table(name="source_operation")
* @ORM\InheritanceType("JOINED")
* @ORM\DiscriminatorColumn(name="discr", type="string")
* @ORM\DiscriminatorMap({"and" = "AndOperation"})
*/
abstract class AbstractOperation extends AbstractSource implements OperationInterface
{

View File

@ -8,7 +8,6 @@ use App\Exception\NotDefinedException;
/**
* @author kevinfrantz
* @ORM\Table(name="source_operation_and")
* @ORM\Entity()
*
* @todo move to the logic level!

View File

@ -2,17 +2,10 @@
namespace App\Entity\Source\Primitive;
use Doctrine\ORM\Mapping as ORM;
use App\Entity\Source\AbstractSource;
/**
* @author kevinfrantz
*
* @ORM\Entity
* @ORM\Table(name="source_data")
* @ORM\InheritanceType("JOINED")
* @ORM\DiscriminatorColumn(name="discr", type="string")
* @ORM\DiscriminatorMap({"name" = "App\Entity\Source\Primitive\Name\AbstractNameSource","text" = "App\Entity\Source\Primitive\Text\TextSource"})
*/
abstract class AbstractPrimitiveSource extends AbstractSource implements PrimitiveSourceInterface
{

View File

@ -9,22 +9,12 @@ use Symfony\Component\Validator\Constraints as Assert;
/**
* @author kevinfrantz
*
* @todo Change to SINGLE_TABLE. JOINED was necessary because SINGLE_TABLE leaded to:
*
* @see << SQLSTATE[42S02]: Base table or view not found: 1146 Table 'DEV_DATABASE.source_data_name' doesn't exist >>
* @ORM\Entity
* @ORM\Table(name="source_data_name")
* @ORM\InheritanceType("JOINED")
* @ORM\DiscriminatorColumn(name="discr", type="string")
* @ORM\DiscriminatorMap({"nickname" = "NicknameSource","firstname" = "FirstNameSource", "surname" = "SurnameSource"})
*/
class AbstractNameSource extends AbstractPrimitiveSource implements NameSourceInterface
{
use NameAttribut;
/**
* @todo Implement an extra assert Layer! - maybe ;)
* @ORM\Column(type="string",length=255)
* @Assert\NotBlank()
*