From 15ea900d7461f4c661f73f766d1f3fd7b36394e3 Mon Sep 17 00:00:00 2001 From: Kevin Frantz Date: Fri, 23 Nov 2018 22:34:44 +0100 Subject: [PATCH] optimized orm structure --- application/src/Entity/Source/AbstractSource.php | 14 +++++++++++++- .../Source/Complex/AbstractComplexSource.php | 7 ------- .../Collection/AbstractCollectionSource.php | 6 ------ .../Complex/Collection/TreeCollectionSource.php | 3 --- .../Entity/Source/Complex/FullPersonNameSource.php | 1 - .../Entity/Source/Complex/PersonIdentitySource.php | 1 - .../src/Entity/Source/Complex/UserSource.php | 1 - .../Entity/Source/Operation/AbstractOperation.php | 4 ---- .../src/Entity/Source/Operation/AndOperation.php | 1 - .../Source/Primitive/AbstractPrimitiveSource.php | 7 ------- .../Source/Primitive/Name/AbstractNameSource.php | 10 ---------- 11 files changed, 13 insertions(+), 42 deletions(-) diff --git a/application/src/Entity/Source/AbstractSource.php b/application/src/Entity/Source/AbstractSource.php index 448550f..0953f2e 100644 --- a/application/src/Entity/Source/AbstractSource.php +++ b/application/src/Entity/Source/AbstractSource.php @@ -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 diff --git a/application/src/Entity/Source/Complex/AbstractComplexSource.php b/application/src/Entity/Source/Complex/AbstractComplexSource.php index e19ca4b..313a934 100644 --- a/application/src/Entity/Source/Complex/AbstractComplexSource.php +++ b/application/src/Entity/Source/Complex/AbstractComplexSource.php @@ -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 { diff --git a/application/src/Entity/Source/Complex/Collection/AbstractCollectionSource.php b/application/src/Entity/Source/Complex/Collection/AbstractCollectionSource.php index e4a19a1..f7aa1d7 100644 --- a/application/src/Entity/Source/Complex/Collection/AbstractCollectionSource.php +++ b/application/src/Entity/Source/Complex/Collection/AbstractCollectionSource.php @@ -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 diff --git a/application/src/Entity/Source/Complex/Collection/TreeCollectionSource.php b/application/src/Entity/Source/Complex/Collection/TreeCollectionSource.php index ed93f05..4601f84 100644 --- a/application/src/Entity/Source/Complex/Collection/TreeCollectionSource.php +++ b/application/src/Entity/Source/Complex/Collection/TreeCollectionSource.php @@ -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 diff --git a/application/src/Entity/Source/Complex/FullPersonNameSource.php b/application/src/Entity/Source/Complex/FullPersonNameSource.php index f93975d..66eb55f 100644 --- a/application/src/Entity/Source/Complex/FullPersonNameSource.php +++ b/application/src/Entity/Source/Complex/FullPersonNameSource.php @@ -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 diff --git a/application/src/Entity/Source/Complex/PersonIdentitySource.php b/application/src/Entity/Source/Complex/PersonIdentitySource.php index 52b5800..7c906ab 100644 --- a/application/src/Entity/Source/Complex/PersonIdentitySource.php +++ b/application/src/Entity/Source/Complex/PersonIdentitySource.php @@ -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 diff --git a/application/src/Entity/Source/Complex/UserSource.php b/application/src/Entity/Source/Complex/UserSource.php index 7ad54bb..55e5396 100644 --- a/application/src/Entity/Source/Complex/UserSource.php +++ b/application/src/Entity/Source/Complex/UserSource.php @@ -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 diff --git a/application/src/Entity/Source/Operation/AbstractOperation.php b/application/src/Entity/Source/Operation/AbstractOperation.php index 0508dcb..009fa1b 100644 --- a/application/src/Entity/Source/Operation/AbstractOperation.php +++ b/application/src/Entity/Source/Operation/AbstractOperation.php @@ -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 { diff --git a/application/src/Entity/Source/Operation/AndOperation.php b/application/src/Entity/Source/Operation/AndOperation.php index 7268bf0..2879364 100644 --- a/application/src/Entity/Source/Operation/AndOperation.php +++ b/application/src/Entity/Source/Operation/AndOperation.php @@ -8,7 +8,6 @@ use App\Exception\NotDefinedException; /** * @author kevinfrantz - * @ORM\Table(name="source_operation_and") * @ORM\Entity() * * @todo move to the logic level! diff --git a/application/src/Entity/Source/Primitive/AbstractPrimitiveSource.php b/application/src/Entity/Source/Primitive/AbstractPrimitiveSource.php index 734766d..cdf5424 100644 --- a/application/src/Entity/Source/Primitive/AbstractPrimitiveSource.php +++ b/application/src/Entity/Source/Primitive/AbstractPrimitiveSource.php @@ -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 { diff --git a/application/src/Entity/Source/Primitive/Name/AbstractNameSource.php b/application/src/Entity/Source/Primitive/Name/AbstractNameSource.php index f0b3ce5..08d5120 100644 --- a/application/src/Entity/Source/Primitive/Name/AbstractNameSource.php +++ b/application/src/Entity/Source/Primitive/Name/AbstractNameSource.php @@ -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() *