<?php
namespace App\Entity;
use App\Repository\FamilyEscandalloRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=FamilyEscandalloRepository::class)
* @ORM\HasLifecycleCallbacks()
*/
class FamilyEscandallo
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\OneToMany(targetEntity=Escandallo::class, mappedBy="familyEscandallo")
*/
private $escandallo;
/**
* @ORM\Column(type="datetime_immutable")
*/
private $createdAt;
/**
* @ORM\Column(type="datetime_immutable")
*/
private $updatedAt;
/**
* @ORM\ManyToOne(targetEntity=User::class)
* @ORM\JoinColumn(nullable=false)
*/
private $createdId;
/**
* @ORM\ManyToOne(targetEntity=User::class)
* @ORM\JoinColumn(nullable=false)
*/
private $updatedId;
public function __construct()
{
$this->escandallo = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
/**
* @return Collection<int, Escandallo>
*/
public function getEscandallo(): Collection
{
return $this->escandallo;
}
public function addEscandallo(Escandallo $escandallo): self
{
if (!$this->escandallo->contains($escandallo)) {
$this->escandallo[] = $escandallo;
$escandallo->setFamilyEscandallo($this);
}
return $this;
}
public function removeEscandallo(Escandallo $escandallo): self
{
if ($this->escandallo->removeElement($escandallo)) {
// set the owning side to null (unless already changed)
if ($escandallo->getFamilyEscandallo() === $this) {
$escandallo->setFamilyEscandallo(null);
}
}
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeImmutable $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt(): ?\DateTimeImmutable
{
return $this->updatedAt;
}
public function setUpdatedAt(\DateTimeImmutable $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* @ORM\PrePersist
*/
public function setCreatedAtValue()
{
$this->createdAt = new \DateTimeImmutable();
}
/**
* @ORM\PrePersist
* @ORM\PreUpdate
*/
public function setUpdatedAtValue()
{
$this->updatedAt = new \DateTimeImmutable();
}
public function getCreatedId(): ?User
{
return $this->createdId;
}
public function setCreatedId(?User $createdId): self
{
$this->createdId = $createdId;
return $this;
}
public function getUpdatedId(): ?User
{
return $this->updatedId;
}
public function setUpdatedId(?User $updatedId): self
{
$this->updatedId = $updatedId;
return $this;
}
}