mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-08 13:51:34 +01:00
Optimized entity mapping
This commit is contained in:
parent
0c852dbec4
commit
3b1330c40f
@ -12,7 +12,7 @@ use App\Entity\Attribut\RelationAttribut;
|
|||||||
* @ORM\Table(name="meta_law")
|
* @ORM\Table(name="meta_law")
|
||||||
* @ORM\Entity(repositoryClass="App\Repository\LawRepository")
|
* @ORM\Entity(repositoryClass="App\Repository\LawRepository")
|
||||||
*/
|
*/
|
||||||
final class Law extends AbstractMeta implements LawInterface
|
class Law extends AbstractMeta implements LawInterface
|
||||||
{
|
{
|
||||||
use RightsAttribute, RelationAttribut;
|
use RightsAttribute, RelationAttribut;
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ use Doctrine\Common\Collections\Collection;
|
|||||||
* @ORM\Table(name="meta_relation")
|
* @ORM\Table(name="meta_relation")
|
||||||
* @ORM\Entity()
|
* @ORM\Entity()
|
||||||
*/
|
*/
|
||||||
final class Relation extends AbstractMeta implements RelationInterface
|
class Relation extends AbstractMeta implements RelationInterface
|
||||||
{
|
{
|
||||||
use IdAttribut,
|
use IdAttribut,
|
||||||
SourceAttribut,
|
SourceAttribut,
|
||||||
|
@ -20,7 +20,7 @@ use App\Entity\Attribut\RelationAttribut;
|
|||||||
* @ORM\Table(name="meta_right")
|
* @ORM\Table(name="meta_right")
|
||||||
* @ORM\Entity(repositoryClass="App\Repository\RightRepository")
|
* @ORM\Entity(repositoryClass="App\Repository\RightRepository")
|
||||||
*/
|
*/
|
||||||
final class Right extends AbstractMeta implements RightInterface
|
class Right extends AbstractMeta implements RightInterface
|
||||||
{
|
{
|
||||||
use TypeAttribut,LawAttribut, RelationAttribut, GrantAttribut,ConditionAttribut,RecieverAttribut,LayerAttribut;
|
use TypeAttribut,LawAttribut, RelationAttribut, GrantAttribut,ConditionAttribut,RecieverAttribut,LayerAttribut;
|
||||||
|
|
||||||
|
@ -7,6 +7,8 @@ use App\Entity\Attribut\SurnameSourceAttribut;
|
|||||||
use App\Entity\Source\Data\Name\SurnameSource;
|
use App\Entity\Source\Data\Name\SurnameSource;
|
||||||
use App\Entity\Source\Data\Name\FirstNameSource;
|
use App\Entity\Source\Data\Name\FirstNameSource;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use App\Entity\Source\Data\Name\SurnameSourceInterface;
|
||||||
|
use App\Entity\Source\Data\Name\FirstNameSourceInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
@ -17,6 +19,22 @@ class FullPersonNameSource extends AbstractCombinationSource implements FullPers
|
|||||||
{
|
{
|
||||||
use FirstNameSourceAttribut,SurnameSourceAttribut;
|
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()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
@ -16,7 +16,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||||||
* @ORM\DiscriminatorColumn(name="discr", type="string")
|
* @ORM\DiscriminatorColumn(name="discr", type="string")
|
||||||
* @ORM\DiscriminatorMap({"nickname" = "NicknameSource","firstname" = "FirstNameSource", "surname" = "SurnameSource"})
|
* @ORM\DiscriminatorMap({"nickname" = "NicknameSource","firstname" = "FirstNameSource", "surname" = "SurnameSource"})
|
||||||
*/
|
*/
|
||||||
abstract class AbstractNameSource extends AbstractDataSource implements NameSourceInterface
|
class AbstractNameSource extends AbstractDataSource implements NameSourceInterface
|
||||||
{
|
{
|
||||||
use NameAttribut;
|
use NameAttribut;
|
||||||
|
|
||||||
|
@ -2,6 +2,12 @@
|
|||||||
|
|
||||||
namespace App\Entity\Source\Data\Name;
|
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
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -6,9 +6,8 @@ use Doctrine\ORM\Mapping as ORM;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
* @ORM\Table(name="source_data_name_nickname")
|
|
||||||
* @ORM\Entity()
|
* @ORM\Entity()
|
||||||
*/
|
*/
|
||||||
final class NicknameSource extends AbstractNameSource implements NicknameSourceInterface
|
class NicknameSource extends AbstractNameSource implements NicknameSourceInterface
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -6,9 +6,8 @@ use Doctrine\ORM\Mapping as ORM;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
* @ORM\Table(name="source_data_name_surname")
|
|
||||||
* @ORM\Entity()
|
* @ORM\Entity()
|
||||||
*/
|
*/
|
||||||
final class SurnameSource extends AbstractNameSource implements SurnameSourceInterface
|
class SurnameSource extends AbstractNameSource implements SurnameSourceInterface
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ use App\Exception\NotDefinedException;
|
|||||||
*
|
*
|
||||||
* @todo move to the logic level!
|
* @todo move to the logic level!
|
||||||
*/
|
*/
|
||||||
final class AndOperation extends AbstractOperation
|
class AndOperation extends AbstractOperation
|
||||||
{
|
{
|
||||||
public function process(): void
|
public function process(): void
|
||||||
{
|
{
|
||||||
|
@ -53,6 +53,8 @@ class UserRepositoryTest extends KernelTestCase
|
|||||||
$this->assertGreaterThan(0, $this->loadedUser->getSource()->getId());
|
$this->assertGreaterThan(0, $this->loadedUser->getSource()->getId());
|
||||||
$this->assertGreaterThan(0, $this->loadedUser->getSource()->getPersonIdentitySource()->getId());
|
$this->assertGreaterThan(0, $this->loadedUser->getSource()->getPersonIdentitySource()->getId());
|
||||||
$this->assertGreaterThan(0, $this->loadedUser->getSource()->getPersonIdentitySource()->getFullPersonNameSource()->getId());
|
$this->assertGreaterThan(0, $this->loadedUser->getSource()->getPersonIdentitySource()->getFullPersonNameSource()->getId());
|
||||||
|
$this->assertGreaterThan(0, $this->loadedUser->getSource()->getPersonIdentitySource()->getFullPersonNameSource()->getFirstNameSource()->getId());
|
||||||
|
$this->assertGreaterThan(0, $this->loadedUser->getSource()->getPersonIdentitySource()->getFullPersonNameSource()->getSurnameSource()->getId());
|
||||||
$this->deleteUser();
|
$this->deleteUser();
|
||||||
$this->assertNull($this->userRepository->find($userId));
|
$this->assertNull($this->userRepository->find($userId));
|
||||||
$this->loadedUser = null;
|
$this->loadedUser = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user