Implemented tests for UserRepository and mapped data schema

This commit is contained in:
Kevin Frantz
2018-11-17 14:48:48 +01:00
parent 5feac4d8ca
commit a7c58ba135
10 changed files with 24 additions and 9 deletions

View File

@@ -31,6 +31,7 @@ abstract class AbstractEntity implements EntityInterface
public function __construct()
{
$this->version = 0;
}
public function __toString(): string

View File

@@ -25,6 +25,7 @@ final class Law extends AbstractMeta implements LawInterface
public function __construct()
{
parent::__construct();
$this->rights = new ArrayCollection();
}
}

View File

@@ -54,7 +54,7 @@ final class Relation extends AbstractMeta implements RelationInterface
/**
* @ORM\OneToOne(targetEntity="App\Entity\Source\AbstractSource",cascade={"persist", "remove"})
* @ORM\JoinColumn(name="source_id", referencedColumnName="id")
* @ORM\JoinColumn(name="source_id", referencedColumnName="id",onDelete="CASCADE")
*
* @var SourceInterface
*/
@@ -70,6 +70,7 @@ final class Relation extends AbstractMeta implements RelationInterface
public function __construct()
{
parent::__construct();
$this->law = new Law();
$this->parents = new ArrayCollection();
$this->childs = new ArrayCollection();

View File

@@ -32,7 +32,7 @@ abstract class AbstractSource extends AbstractEntity implements SourceInterface
/**
* @var RelationInterface
* @ORM\OneToOne(targetEntity="App\Entity\Meta\Relation",cascade={"persist", "remove"})
* @ORM\JoinColumn(name="relation_id", referencedColumnName="id")
* @ORM\JoinColumn(name="relation_id", referencedColumnName="id", onDelete="CASCADE")
* @Exclude
*/
protected $relation;

View File

@@ -18,7 +18,7 @@ class UserSource extends AbstractCombinationSource implements UserSourceInterfac
/**
* @ORM\OneToOne(targetEntity="App\Entity\User",cascade={"persist", "remove"})
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id",onDelete="CASCADE")
*
* @var UserInterface
*/

View File

@@ -22,7 +22,7 @@ class User extends BaseUser implements UserInterface
/**
* @var UserSourceInterface
* @ORM\OneToOne(targetEntity="App\Entity\Source\Combination\UserSource",cascade={"persist", "remove"})
* @ORM\JoinColumn(name="source_user_id", referencedColumnName="id")
* @ORM\JoinColumn(name="source_user_id", referencedColumnName="id", onDelete="CASCADE")
*/
protected $source;
@@ -51,6 +51,7 @@ class User extends BaseUser implements UserInterface
public function __construct()
{
parent::__construct();
$this->version = 0;
$this->isActive = true;
$this->source = new UserSource();
$this->source->setUser($this);