mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-04-16 02:06:23 +02:00
Added new entity draft
This commit is contained in:
parent
0ee29d3456
commit
00965aab5c
24
application/src/Entity/AbstractEntity.php
Normal file
24
application/src/Entity/AbstractEntity.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use App\Entity\Attribut\IdAttribut;
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author kevinfrantz
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class AbstractEntity
|
||||||
|
{
|
||||||
|
use IdAttribut;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Id()
|
||||||
|
* @ORM\GeneratedValue
|
||||||
|
* @ORM\Column(type="integer")(strategy="AUTO")
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected $id;
|
||||||
|
}
|
||||||
|
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Entity;
|
namespace App\Entity;
|
||||||
|
|
||||||
use App\Entity\Attribut\IdAttribut;
|
|
||||||
use App\Entity\Attribut\NodeAttribut;
|
use App\Entity\Attribut\NodeAttribut;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
@ -13,13 +12,21 @@ use Doctrine\ORM\Mapping as ORM;
|
|||||||
* @ORM\Entity
|
* @ORM\Entity
|
||||||
* @ORM\InheritanceType("JOINED")
|
* @ORM\InheritanceType("JOINED")
|
||||||
* @ORM\DiscriminatorColumn(name="discr", type="string")
|
* @ORM\DiscriminatorColumn(name="discr", type="string")
|
||||||
* @ORM\DiscriminatorMap({"user" = "User"})
|
* @ORM\DiscriminatorMap({"user" = "UserSource"})
|
||||||
*/
|
*/
|
||||||
abstract class AbstractSource implements SourceInterface
|
abstract class AbstractSource extends AbstractEntity implements SourceInterface
|
||||||
{
|
{
|
||||||
use IdAttribut,NodeAttribut;
|
use NodeAttribut;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var NodeInterface
|
||||||
|
* @ORM\OneToOne(targetEntity="Node",cascade={"persist", "remove"})
|
||||||
|
* @ORM\JoinColumn(name="node_id", referencedColumnName="id")
|
||||||
|
*/
|
||||||
|
protected $node;
|
||||||
|
|
||||||
public function __construct(){
|
public function __construct(){
|
||||||
$this->node = new Node();
|
$this->node = new Node();
|
||||||
|
$this->node->setSource($this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Entity\Attribut;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author kevinfrantz
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
interface BlacklistAttributInterface
|
||||||
|
{
|
||||||
|
public function setBlacklist(?bool $value): void;
|
||||||
|
|
||||||
|
public function getBlacklist(): ?bool;
|
||||||
|
}
|
||||||
|
|
@ -2,17 +2,13 @@
|
|||||||
|
|
||||||
namespace App\Entity\Attribut;
|
namespace App\Entity\Attribut;
|
||||||
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
*/
|
*/
|
||||||
trait IdAttribut
|
trait IdAttribut
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @ORM\Id()
|
* @var int
|
||||||
* @ORM\GeneratedValue
|
|
||||||
* @ORM\Column(type="integer")(strategy="AUTO")
|
|
||||||
*/
|
*/
|
||||||
protected $id;
|
protected $id;
|
||||||
|
|
||||||
|
26
application/src/Entity/Attribut/LawAttribut.php
Normal file
26
application/src/Entity/Attribut/LawAttribut.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Entity\Attribut;
|
||||||
|
|
||||||
|
use App\Entity\LawInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author kevinfrantz
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
trait LawAttribut {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var LawInterface
|
||||||
|
*/
|
||||||
|
protected $law;
|
||||||
|
|
||||||
|
public function setLaw(LawInterface $law):void{
|
||||||
|
$this->law = $law;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLaw(): LawInterface{
|
||||||
|
return $this->law;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
18
application/src/Entity/Attribut/LawAttributInterface.php
Normal file
18
application/src/Entity/Attribut/LawAttributInterface.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Entity\Attribut;
|
||||||
|
|
||||||
|
use App\Entity\LawInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author kevinfrantz
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
interface LawAttributInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public function setLaw(LawInterface $law):void;
|
||||||
|
|
||||||
|
public function getLaw(): LawInterface;
|
||||||
|
}
|
||||||
|
|
@ -11,8 +11,6 @@ trait NodeAttribut
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var NodeInterface
|
* @var NodeInterface
|
||||||
* @ORM\OneToOne(targetEntity="Node",cascade={"persist", "remove"})
|
|
||||||
* @ORM\JoinColumn(name="node_id", referencedColumnName="id")
|
|
||||||
*/
|
*/
|
||||||
protected $node;
|
protected $node;
|
||||||
|
|
||||||
|
15
application/src/Entity/Attribut/RightAttributInterface.php
Normal file
15
application/src/Entity/Attribut/RightAttributInterface.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
namespace Entity\Attribut;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author kevinfrantz
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
interface RightAttributInterface
|
||||||
|
{
|
||||||
|
public function setRight(string $right):void;
|
||||||
|
|
||||||
|
public function getRight():string;
|
||||||
|
}
|
||||||
|
|
26
application/src/Entity/Attribut/UserAttribut.php
Normal file
26
application/src/Entity/Attribut/UserAttribut.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Entity\Attribut;
|
||||||
|
|
||||||
|
use App\Entity\User;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author kevinfrantz
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
trait UserAttribut {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var User
|
||||||
|
*/
|
||||||
|
protected $user;
|
||||||
|
|
||||||
|
public function setUser(User $user):void{
|
||||||
|
$this->user = $user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUser():User{
|
||||||
|
return $this->user;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
17
application/src/Entity/Attribut/UserAttributInterface.php
Normal file
17
application/src/Entity/Attribut/UserAttributInterface.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Entity\Attribut;
|
||||||
|
|
||||||
|
use App\Entity\User;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author kevinfrantz
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
interface UserAttributInterface
|
||||||
|
{
|
||||||
|
public function setUser(User $user):void;
|
||||||
|
|
||||||
|
public function getUser():User;
|
||||||
|
}
|
||||||
|
|
28
application/src/Entity/Attribut/UserSourceAttribut.php
Normal file
28
application/src/Entity/Attribut/UserSourceAttribut.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
namespace Entity\Attribut;
|
||||||
|
|
||||||
|
use App\Entity\UserSourceInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author kevinfrantz
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
trait UserSource {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var UserSourceInterface
|
||||||
|
* @ORM\OneToOne(targetEntity="UserSource",cascade={"persist", "remove"})
|
||||||
|
* @ORM\JoinColumn(name="source_user_id", referencedColumnName="id")
|
||||||
|
*/
|
||||||
|
protected $userSource;
|
||||||
|
|
||||||
|
public function setUserSource(UserSourceInterface $userSource):void{
|
||||||
|
$this->user = $userSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUserSource():UserSourceInterface{
|
||||||
|
return $this->userSource;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
namespace Entity\Attribut;
|
||||||
|
|
||||||
|
use App\Entity\UserSourceInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author kevinfrantz
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
interface UserSourceAttributInterface
|
||||||
|
{
|
||||||
|
public function setUserSource(UserSourceInterface $user):void;
|
||||||
|
|
||||||
|
public function getUserSource():UserSourceInterface;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
namespace Entity\Attribut;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author kevinfrantz
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
interface WhitelistAttributInterface
|
||||||
|
{
|
||||||
|
public function setWhitelist(?bool $value): void;
|
||||||
|
|
||||||
|
public function getWhitelist(): ?bool;
|
||||||
|
}
|
||||||
|
|
15
application/src/Entity/Law.php
Normal file
15
application/src/Entity/Law.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use App\Entity\Attribut\NodeAttribut;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author kevinfrantz
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class Law implements LawInterface
|
||||||
|
{
|
||||||
|
use NodeAttribut;
|
||||||
|
}
|
||||||
|
|
14
application/src/Entity/LawInterface.php
Normal file
14
application/src/Entity/LawInterface.php
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use App\Entity\Attribut\NodeAttributInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author kevinfrantz
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
interface LawInterface extends NodeAttributInterface
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
@ -7,16 +7,22 @@ use App\Entity\Attribut\IdAttribut;
|
|||||||
use App\Entity\Attribut\SourceAttribut;
|
use App\Entity\Attribut\SourceAttribut;
|
||||||
use App\Entity\Attribut\ParentAttribut;
|
use App\Entity\Attribut\ParentAttribut;
|
||||||
use App\Entity\Attribut\ChildsAttribut;
|
use App\Entity\Attribut\ChildsAttribut;
|
||||||
|
use App\Entity\Attribut\LawAttribut;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
* @ORM\Table(name="node")
|
* @ORM\Table(name="node")
|
||||||
* @ORM\Entity(repositoryClass="App\Repository\NodeRepository")
|
* @ORM\Entity(repositoryClass="App\Repository\NodeRepository")
|
||||||
*/
|
*/
|
||||||
class Node implements NodeInterface
|
class Node extends AbstractEntity implements NodeInterface
|
||||||
{
|
{
|
||||||
use IdAttribut,
|
use IdAttribut,
|
||||||
SourceAttribut,
|
SourceAttribut,
|
||||||
ParentAttribut,
|
ParentAttribut,
|
||||||
|
LawAttribut,
|
||||||
ChildsAttribut;
|
ChildsAttribut;
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
$this->law = new Law();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,10 +6,11 @@ use App\Entity\Attribut\SourceAttributInterface;
|
|||||||
use App\Entity\Attribut\IdAttributInterface;
|
use App\Entity\Attribut\IdAttributInterface;
|
||||||
use App\Entity\Attribut\ParentsAttributInterface;
|
use App\Entity\Attribut\ParentsAttributInterface;
|
||||||
use App\Entity\Attribut\ChildsAttributeInterface;
|
use App\Entity\Attribut\ChildsAttributeInterface;
|
||||||
|
use App\Entity\Attribut\LawAttributInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
*/
|
*/
|
||||||
interface NodeInterface extends SourceAttributInterface, IdAttributInterface, ParentsAttributInterface, ChildsAttributeInterface
|
interface NodeInterface extends SourceAttributInterface, IdAttributInterface, ParentsAttributInterface, ChildsAttributeInterface, LawAttributInterface
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
15
application/src/Entity/PermissionInterface.php
Normal file
15
application/src/Entity/PermissionInterface.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
namespace Entity;
|
||||||
|
|
||||||
|
use App\Entity\Attribut\BlacklistAttributInterface;
|
||||||
|
use Entity\Attribut\WhitelistAttributInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author kevinfrantz
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
interface PermissionInterface extends BlacklistAttributInterface, WhitelistAttributInterface
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
12
application/src/Entity/RightInterface.php
Normal file
12
application/src/Entity/RightInterface.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Entity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author kevinfrantz
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
interface RightInterface
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
@ -4,16 +4,25 @@ namespace App\Entity;
|
|||||||
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use FOS\UserBundle\Model\User as BaseUser;
|
use FOS\UserBundle\Model\User as BaseUser;
|
||||||
use App\Entity\Attribut\NodeAttribut;
|
use App\Entity\Attribut\SourceAttributInterface;
|
||||||
|
use App\Entity\Attribut\SourceAttribut;
|
||||||
|
use App\Entity\Attribut\IdAttribut;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
* @ORM\Table(name="source_user")
|
* @ORM\Table(name="user")
|
||||||
* @ORM\Entity(repositoryClass="App\Repository\UserRepository")
|
* @ORM\Entity(repositoryClass="App\Repository\UserRepository")
|
||||||
*/
|
*/
|
||||||
class User extends BaseUser implements SourceInterface
|
class User extends BaseUser implements SourceAttributInterface
|
||||||
{
|
{
|
||||||
use NodeAttribut;
|
use SourceAttribut,IdAttribut;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var UserSourceInterface
|
||||||
|
* @ORM\OneToOne(targetEntity="UserSource",cascade={"persist", "remove"})
|
||||||
|
* @ORM\JoinColumn(name="source_user_id", referencedColumnName="id")
|
||||||
|
*/
|
||||||
|
protected $source;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(name="is_active", type="boolean")
|
* @ORM\Column(name="is_active", type="boolean")
|
||||||
@ -27,24 +36,10 @@ class User extends BaseUser implements SourceInterface
|
|||||||
*/
|
*/
|
||||||
protected $id;
|
protected $id;
|
||||||
|
|
||||||
public function setId(int $id): void
|
|
||||||
{
|
|
||||||
$this->id = $id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getId(): int
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
/*
|
|
||||||
* @todo Remove this later
|
|
||||||
* @var \App\Entity\User $isActive
|
|
||||||
*/
|
|
||||||
$this->isActive = true;
|
$this->isActive = true;
|
||||||
$this->node = new Node();
|
$this->source = new UserSource();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
24
application/src/Entity/UserSource.php
Normal file
24
application/src/Entity/UserSource.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use App\Entity\Attribut\UserAttribut;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author kevinfrantz
|
||||||
|
* @ORM\Table(name="source_user")
|
||||||
|
* @ORM\Entity(repositoryClass="App\Repository\UserSourceRepository")
|
||||||
|
*/
|
||||||
|
class UserSource extends AbstractSource implements UserSourceInterface
|
||||||
|
{
|
||||||
|
use UserAttribut;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\OneToOne(targetEntity="User")
|
||||||
|
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
|
||||||
|
* @var User
|
||||||
|
*/
|
||||||
|
protected $user;
|
||||||
|
|
||||||
|
}
|
14
application/src/Entity/UserSourceInterface.php
Normal file
14
application/src/Entity/UserSourceInterface.php
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use App\Entity\Attribut\UserAttributInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author kevinfrantz
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
interface UserSourceInterface extends SourceInterface, UserAttributInterface
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
@ -69,7 +69,6 @@ A **node** MAY be a member of one or more **relative collection** s.
|
|||||||
|
|
||||||
A **node** MAY be a member of one or more **collection** entity.
|
A **node** MAY be a member of one or more **collection** entity.
|
||||||
|
|
||||||
|
|
||||||
A **node** MUST have a **law**.
|
A **node** MUST have a **law**.
|
||||||
|
|
||||||
A **node** MUST have a **history**.
|
A **node** MUST have a **history**.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user