mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-14 06:07:18 +02:00
Optimized ORM-Structure
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
namespace App\Entity\Attribut;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use App\Entity\NodeInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
@@ -9,8 +11,14 @@ use Doctrine\Common\Collections\ArrayCollection;
|
||||
*/
|
||||
trait ChildsAttribut {
|
||||
|
||||
/**
|
||||
* @var ArrayCollection
|
||||
/**
|
||||
* Many Nodes have many childs
|
||||
* @ORM\ManyToMany(targetEntity="Node")
|
||||
* @ORM\JoinTable(name="nodes_childs",
|
||||
* joinColumns={@ORM\JoinColumn(name="node_id", referencedColumnName="id")},
|
||||
* inverseJoinColumns={@ORM\JoinColumn(name="node_id", referencedColumnName="id")}
|
||||
* )
|
||||
* @var ArrayCollection|NodeInterface[]
|
||||
*/
|
||||
protected $childs;
|
||||
|
||||
|
@@ -2,6 +2,7 @@
|
||||
namespace App\Entity\Attribut;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use App\Entity\NodeInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -9,17 +10,24 @@ use Doctrine\Common\Collections\ArrayCollection;
|
||||
*
|
||||
*/
|
||||
trait ParentAttribut {
|
||||
|
||||
|
||||
/**
|
||||
* @var ArrayCollection
|
||||
* Many Nodes have many parents
|
||||
*
|
||||
* @ORM\ManyToMany(targetEntity="Node")
|
||||
* @ORM\JoinTable(name="nodes_parents",
|
||||
* joinColumns={@ORM\JoinColumn(name="node_id", referencedColumnName="id")},
|
||||
* inverseJoinColumns={@ORM\JoinColumn(name="node_id", referencedColumnName="id")}
|
||||
* )
|
||||
* @var ArrayCollection|NodeInterface[]
|
||||
*/
|
||||
protected $parents;
|
||||
|
||||
|
||||
public function getParents(): ArrayCollection
|
||||
{
|
||||
return $this->parents;
|
||||
}
|
||||
|
||||
|
||||
public function setParents(ArrayCollection $parents): void
|
||||
{
|
||||
$this->parents = $parents;
|
||||
|
24
application/src/Entity/Attribut/PasswordAttribut.php
Normal file
24
application/src/Entity/Attribut/PasswordAttribut.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace App\Entity\Attribut;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
trait PasswordAttribut {
|
||||
/**
|
||||
* @ORM\Column(type="string", length=64)
|
||||
*/
|
||||
protected $password;
|
||||
|
||||
public function getPassword():string
|
||||
{
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
public function setPassword(string $password):void{
|
||||
$this->password = $password;
|
||||
}
|
||||
}
|
||||
|
25
application/src/Entity/Attribut/UsernameAttribut.php
Normal file
25
application/src/Entity/Attribut/UsernameAttribut.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace App\Entity\Attribut;
|
||||
|
||||
/**
|
||||
* This trait doesn't need an own interface because it's covered by symfony
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
trait UsernameAttribut{
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=25, unique=true)
|
||||
*/
|
||||
protected $username;
|
||||
|
||||
public function getUsername():string
|
||||
{
|
||||
return $this->username;
|
||||
}
|
||||
|
||||
public function setUsernames(string $username):void{
|
||||
$this->username = $username;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user