<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Entity(repositoryClass="App\Repository\CCAARepository")
* @ORM\Table(name="ccaa", schema="perseo")
* @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=true)
*/
class CCAA
{
/**
* @ORM\Id
* @ORM\Column(type="bigint")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="string", length=100, nullable=false)
* @Gedmo\Translatable
*/
protected $nombre;
/**
* @ORM\Column(type="datetime", nullable=true, name="deleted_at")
*/
protected $deletedAt;
/**
* @ORM\Column(type="datetime", nullable=false, name="updated_at", options={"default":"2022-01-01 00:00:00"})
* @Gedmo\Timestampable(on="update")
*/
protected $updatedAt;
/**
* @ORM\Column(type="datetime", nullable=false, name="created_at", options={"default":"2022-01-01 00:00:00"})
* @Gedmo\Timestampable(on="create")
*/
protected $createdAt;
/**
* @ORM\Column(type="string", length=2, nullable=true, name="pais")
*/
protected $pais;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Provincia", mappedBy="ccaa")
*/
protected $provincias;
/**
* @ORM\OneToMany(targetEntity="App\Entity\User", mappedBy="ccaa")
*/
protected $user;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Cliente", mappedBy="ccaa")
*/
protected $clientes;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Venta", mappedBy="direccionFacturacionCcaa")
*/
protected $direccionFacturacionCcaaVentas;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Venta", mappedBy="direccionEnvioCcaa")
*/
protected $direccionEnvioCcaaVentas;
public function __construct()
{
$this->provincias = new ArrayCollection();
$this->user = new ArrayCollection();
$this->direccionFacturacionCcaaVentas = new ArrayCollection();
$this->direccionEnvioCcaaVentas = new ArrayCollection();
$this->clientes = new ArrayCollection();
}
public function __toString(): string
{
return $this->getNombre()??'---';
}
public function getId(): ?string
{
return $this->id;
}
public function getNombre(): ?string
{
return $this->nombre;
}
public function setNombre(string $nombre): self
{
$this->nombre = $nombre;
return $this;
}
public function getDeletedAt(): ?\DateTimeInterface
{
return $this->deletedAt;
}
public function setDeletedAt(?\DateTimeInterface $deletedAt): self
{
$this->deletedAt = $deletedAt;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
public function setUpdatedAt(\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
/**
* @return Collection|Provincia[]
*/
public function getProvincias(): Collection
{
return $this->provincias;
}
public function addProvincia(Provincia $provincia): self
{
if (!$this->provincias->contains($provincia)) {
$this->provincias[] = $provincia;
$provincia->setCcaa($this);
}
return $this;
}
public function removeProvincia(Provincia $provincia): self
{
if ($this->provincias->removeElement($provincia)) {
// set the owning side to null (unless already changed)
if ($provincia->getCcaa() === $this) {
$provincia->setCcaa(null);
}
}
return $this;
}
/**
* @return Collection|User[]
*/
public function getUser(): Collection
{
return $this->user;
}
public function addUser(User $user): self
{
if (!$this->user->contains($user)) {
$this->user[] = $user;
$user->setCcaa($this);
}
return $this;
}
public function removeUser(User $user): self
{
if ($this->user->removeElement($user)) {
// set the owning side to null (unless already changed)
if ($user->getCcaa() === $this) {
$user->setCcaa(null);
}
}
return $this;
}
/**
* @return Collection|Venta[]
*/
public function getDireccionFacturacionCcaaVentas(): Collection
{
return $this->direccionFacturacionCcaaVentas;
}
public function addDireccionFacturacionCcaaVenta(Venta $direccionFacturacionCcaaVenta): self
{
if (!$this->direccionFacturacionCcaaVentas->contains($direccionFacturacionCcaaVenta)) {
$this->direccionFacturacionCcaaVentas[] = $direccionFacturacionCcaaVenta;
$direccionFacturacionCcaaVenta->setDireccionFacturacionCcaa($this);
}
return $this;
}
public function removeDireccionFacturacionCcaaVenta(Venta $direccionFacturacionCcaaVenta): self
{
if ($this->direccionFacturacionCcaaVentas->removeElement($direccionFacturacionCcaaVenta)) {
// set the owning side to null (unless already changed)
if ($direccionFacturacionCcaaVenta->getDireccionFacturacionCcaa() === $this) {
$direccionFacturacionCcaaVenta->setDireccionFacturacionCcaa(null);
}
}
return $this;
}
/**
* @return Collection|Venta[]
*/
public function getDireccionEnvioCcaaVentas(): Collection
{
return $this->direccionEnvioCcaaVentas;
}
public function addDireccionEnvioCcaaVenta(Venta $direccionEnvioCcaaVenta): self
{
if (!$this->direccionEnvioCcaaVentas->contains($direccionEnvioCcaaVenta)) {
$this->direccionEnvioCcaaVentas[] = $direccionEnvioCcaaVenta;
$direccionEnvioCcaaVenta->setDireccionEnvioCcaa($this);
}
return $this;
}
public function removeDireccionEnvioCcaaVenta(Venta $direccionEnvioCcaaVenta): self
{
if ($this->direccionEnvioCcaaVentas->removeElement($direccionEnvioCcaaVenta)) {
// set the owning side to null (unless already changed)
if ($direccionEnvioCcaaVenta->getDireccionEnvioCcaa() === $this) {
$direccionEnvioCcaaVenta->setDireccionEnvioCcaa(null);
}
}
return $this;
}
public function getPais(): ?string
{
return $this->pais;
}
public function setPais(?string $pais): self
{
$this->pais = $pais;
return $this;
}
/**
* @return Collection|Cliente[]
*/
public function getClientes(): Collection
{
return $this->clientes;
}
public function addCliente(Cliente $cliente): self
{
if (!$this->clientes->contains($cliente)) {
$this->clientes[] = $cliente;
$cliente->setCcaa($this);
}
return $this;
}
public function removeCliente(Cliente $cliente): self
{
if ($this->clientes->removeElement($cliente)) {
// set the owning side to null (unless already changed)
if ($cliente->getCcaa() === $this) {
$cliente->setCcaa(null);
}
}
return $this;
}
}