<?php
namespace App\Entity;
use App\Entity\GuardianRegister\GuardianRegister;
use App\Entity\Guardian\GuardianContractPrice;
use App\Repository\GuardianContractRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ORM\Entity(repositoryClass=GuardianContractRepository::class)
*/
class GuardianContract
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups({"GuardianContractPriceList"})
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $filePath;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $dateUpdated;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $comment;
/**
* @ORM\OneToMany(targetEntity=Guardian::class, mappedBy="guardianContract")
*/
private $guardians;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $createdAt;
/**
* @ORM\OneToMany(targetEntity=GuardianRegister::class, mappedBy="guardianContract")
*/
private $guardianRegisters;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $flagTrial;
/**
* @ORM\OneToOne(targetEntity=GuardianContractPrice::class, mappedBy="guardianContract", cascade={"persist", "remove"})
*/
private $guardianContractPrice;
public function __construct()
{
$this->guardians = new ArrayCollection();
$this->guardianRegisters = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getFilePath(): ?string
{
return $this->filePath;
}
public function setFilePath(?string $filePath): self
{
$this->filePath = $filePath;
return $this;
}
public function getDateUpdated(): ?\DateTimeInterface
{
return $this->dateUpdated;
}
public function setDateUpdated(?\DateTimeInterface $dateUpdated): self
{
$this->dateUpdated = $dateUpdated;
return $this;
}
public function getComment(): ?string
{
return $this->comment;
}
public function setComment(?string $comment): self
{
$this->comment = $comment;
return $this;
}
/**
* @return Collection|Guardian[]
*/
public function getGuardians(): Collection
{
return $this->guardians;
}
public function addGuardian(Guardian $guardian): self
{
if (!$this->guardians->contains($guardian)) {
$this->guardians[] = $guardian;
$guardian->setGuardianContract($this);
}
return $this;
}
public function removeGuardian(Guardian $guardian): self
{
if ($this->guardians->removeElement($guardian)) {
// set the owning side to null (unless already changed)
if ($guardian->getGuardianContract() === $this) {
$guardian->setGuardianContract(null);
}
}
return $this;
}
public function __toString()
{
return "{$this->id} {$this->filePath}";
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
/**
* @return Collection<int, GuardianRegister>
*/
public function getGuardianRegisters(): Collection
{
return $this->guardianRegisters;
}
public function addGuardianRegister(GuardianRegister $guardianRegister): self
{
if (!$this->guardianRegisters->contains($guardianRegister)) {
$this->guardianRegisters[] = $guardianRegister;
$guardianRegister->setGuardianContract($this);
}
return $this;
}
public function removeGuardianRegister(GuardianRegister $guardianRegister): self
{
if ($this->guardianRegisters->removeElement($guardianRegister)) {
// set the owning side to null (unless already changed)
if ($guardianRegister->getGuardianContract() === $this) {
$guardianRegister->setGuardianContract(null);
}
}
return $this;
}
public function getFlagTrial(): ?bool
{
return $this->flagTrial;
}
public function setFlagTrial(?bool $flagTrial): self
{
$this->flagTrial = $flagTrial;
return $this;
}
public function getGuardianContractPrice(): ?GuardianContractPrice
{
return $this->guardianContractPrice;
}
public function setGuardianContractPrice(?GuardianContractPrice $guardianContractPrice): self
{
// unset the owning side of the relation if necessary
if ($guardianContractPrice === null && $this->guardianContractPrice !== null) {
$this->guardianContractPrice->setGuardianContract(null);
}
// set the owning side of the relation if necessary
if ($guardianContractPrice !== null && $guardianContractPrice->getGuardianContract() !== $this) {
$guardianContractPrice->setGuardianContract($this);
}
$this->guardianContractPrice = $guardianContractPrice;
return $this;
}
}