From 3ca5f3dc365b13bc155c722d7ef49ad53d63c7b3 Mon Sep 17 00:00:00 2001 From: Kevin Frantz Date: Wed, 16 Jan 2019 20:40:15 +0100 Subject: [PATCH] Refactored Repositories --- application/symfony/src/Entity/Meta/Law.php | 2 +- application/symfony/src/Entity/Meta/Right.php | 12 +++++++++++- .../src/Entity/Source/Complex/UserSource.php | 2 +- .../{LawRepository.php => AbstractRepository.php} | 2 +- .../symfony/src/Repository/Meta/LawRepository.php | 12 ++++++++++++ .../src/Repository/Meta/RightRepository.php | 12 ++++++++++++ .../symfony/src/Repository/RepositoryInterface.php | 13 +++++++++++++ .../symfony/src/Repository/RightRepository.php | 12 ------------ .../Source/Complex/UserSourceRepository.php | 14 ++++++++++++++ .../src/Repository/Source/SourceRepository.php | 4 ++-- .../Source/SourceRepositoryInterface.php | 5 ++--- .../symfony/src/Repository/UserRepository.php | 4 +--- .../src/Repository/UserSourceRepository.php | 14 -------------- 13 files changed, 70 insertions(+), 38 deletions(-) rename application/symfony/src/Repository/{LawRepository.php => AbstractRepository.php} (53%) create mode 100644 application/symfony/src/Repository/Meta/LawRepository.php create mode 100644 application/symfony/src/Repository/Meta/RightRepository.php create mode 100644 application/symfony/src/Repository/RepositoryInterface.php delete mode 100644 application/symfony/src/Repository/RightRepository.php create mode 100644 application/symfony/src/Repository/Source/Complex/UserSourceRepository.php delete mode 100644 application/symfony/src/Repository/UserSourceRepository.php diff --git a/application/symfony/src/Entity/Meta/Law.php b/application/symfony/src/Entity/Meta/Law.php index c3c80f1..f890a7f 100644 --- a/application/symfony/src/Entity/Meta/Law.php +++ b/application/symfony/src/Entity/Meta/Law.php @@ -12,7 +12,7 @@ use App\Entity\Attribut\GrantAttribut; /** * @author kevinfrantz * @ORM\Table(name="meta_law") - * @ORM\Entity(repositoryClass="App\Repository\LawRepository") + * @ORM\Entity(repositoryClass="App\Repository\Meta\LawRepository") */ class Law extends AbstractMeta implements LawInterface { diff --git a/application/symfony/src/Entity/Meta/Right.php b/application/symfony/src/Entity/Meta/Right.php index 108c261..721dc36 100644 --- a/application/symfony/src/Entity/Meta/Right.php +++ b/application/symfony/src/Entity/Meta/Right.php @@ -23,7 +23,7 @@ use App\DBAL\Types\Meta\Right\CRUDType; * * @author kevinfrantz * @ORM\Table(name="meta_right") - * @ORM\Entity(repositoryClass="App\Repository\RightRepository") + * @ORM\Entity(repositoryClass="App\Repository\Meta\RightRepository") */ class Right extends AbstractMeta implements RightInterface { @@ -99,6 +99,11 @@ class Right extends AbstractMeta implements RightInterface $this->priority = 0; } + /** + * {@inheritdoc} + * + * @see \App\Entity\Attribut\TypeAttributInterface::setType() + */ public function setType(string $type): void { if (!array_key_exists($type, CRUDType::getChoices())) { @@ -107,6 +112,11 @@ class Right extends AbstractMeta implements RightInterface $this->type = $type; } + /** + * {@inheritdoc} + * + * @see \App\Entity\Attribut\LayerAttributInterface::setLayer() + */ public function setLayer(string $layer): void { if (!array_key_exists($layer, LayerType::getChoices())) { diff --git a/application/symfony/src/Entity/Source/Complex/UserSource.php b/application/symfony/src/Entity/Source/Complex/UserSource.php index 55e5396..ed32041 100644 --- a/application/symfony/src/Entity/Source/Complex/UserSource.php +++ b/application/symfony/src/Entity/Source/Complex/UserSource.php @@ -9,7 +9,7 @@ use App\Entity\Attribut\PersonIdentitySourceAttribut; /** * @author kevinfrantz - * @ORM\Entity(repositoryClass="App\Repository\UserSourceRepository") + * @ORM\Entity(repositoryClass="App\Repository\Source\Complex\UserSourceRepository") */ class UserSource extends AbstractComplexSource implements UserSourceInterface { diff --git a/application/symfony/src/Repository/LawRepository.php b/application/symfony/src/Repository/AbstractRepository.php similarity index 53% rename from application/symfony/src/Repository/LawRepository.php rename to application/symfony/src/Repository/AbstractRepository.php index 9638fe4..f0e8683 100644 --- a/application/symfony/src/Repository/LawRepository.php +++ b/application/symfony/src/Repository/AbstractRepository.php @@ -7,6 +7,6 @@ use Doctrine\ORM\EntityRepository; /** * @author kevinfrantz */ -class LawRepository extends EntityRepository +abstract class AbstractRepository extends EntityRepository implements RepositoryInterface { } diff --git a/application/symfony/src/Repository/Meta/LawRepository.php b/application/symfony/src/Repository/Meta/LawRepository.php new file mode 100644 index 0000000..d16e686 --- /dev/null +++ b/application/symfony/src/Repository/Meta/LawRepository.php @@ -0,0 +1,12 @@ +