mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
relation and relationship entities created + endpoints. Still something wrong with link between Relation and Relationship
This commit is contained in:
@@ -0,0 +1,182 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\PersonBundle\Entity\Relationships;
|
||||
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Entity\Relationships\Relation;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
|
||||
/**
|
||||
* @ORM\Entity()
|
||||
* @ORM\Table(name="chill_person_relationships")
|
||||
*/
|
||||
class Relationship
|
||||
{
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue
|
||||
* @ORM\Column(type="integer")
|
||||
* @Groups({"read"})
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=Person::class)
|
||||
* @ORM\JoinColumn(nullable=false)
|
||||
* @Assert\NotBlank()
|
||||
* @Groups({"read", "write"})
|
||||
*/
|
||||
private $fromPerson;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=Person::class)
|
||||
* @ORM\JoinColumn(nullable=false)
|
||||
* @Assert\NotBlank()
|
||||
* @Groups({"read", "write"})
|
||||
*/
|
||||
private $toPerson;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=Relation::class, inversedBy="relationships")
|
||||
* @ORM\JoinColumn(nullable=false)
|
||||
* @Assert\NotBlank()
|
||||
* @Groups({"read", "write"})
|
||||
*/
|
||||
private $relation;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="boolean")
|
||||
* @Assert\Type(
|
||||
* type="bool",
|
||||
* message="This must be of type boolean"
|
||||
* )
|
||||
* @Groups({"read"})
|
||||
*/
|
||||
private $reverse;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=User::class)
|
||||
* @ORM\JoinColumn(nullable=false)
|
||||
*/
|
||||
private $createdBy;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="datetime_immutable")
|
||||
*/
|
||||
private $createdAt;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=User::class)
|
||||
*/
|
||||
private $updatedBy;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="datetime_immutable", nullable=true)
|
||||
*/
|
||||
private $updatedAt;
|
||||
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getFromPerson(): ?Person
|
||||
{
|
||||
return $this->fromPerson;
|
||||
}
|
||||
|
||||
public function setFromPerson(?Person $fromPerson): self
|
||||
{
|
||||
$this->fromPerson = $fromPerson;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getToPerson(): ?Person
|
||||
{
|
||||
return $this->toPerson;
|
||||
}
|
||||
|
||||
public function setToPerson(?Person $toPerson): self
|
||||
{
|
||||
$this->toPerson = $toPerson;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getReverse(): ?bool
|
||||
{
|
||||
return $this->reverse;
|
||||
}
|
||||
|
||||
public function setReverse(bool $reverse): self
|
||||
{
|
||||
$this->reverse = $reverse;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCreatedBy(): ?User
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
public function setCreatedBy(?User $createdBy): self
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCreatedAt(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
||||
public function setCreatedAt(\DateTimeImmutable $createdAt): self
|
||||
{
|
||||
$this->createdAt = $createdAt;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getUpdatedBy(): ?User
|
||||
{
|
||||
return $this->updatedBy;
|
||||
}
|
||||
|
||||
public function setUpdatedBy(?User $updatedBy): self
|
||||
{
|
||||
$this->updatedBy = $updatedBy;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getUpdatedAt(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->updatedAt;
|
||||
}
|
||||
|
||||
public function setUpdatedAt(?\DateTimeImmutable $updatedAt): self
|
||||
{
|
||||
$this->updatedAt = $updatedAt;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRelation(): ?Relation
|
||||
{
|
||||
return $this->relation;
|
||||
}
|
||||
|
||||
public function setRelation(?Relation $relation): self
|
||||
{
|
||||
$this->relation = $relation;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user