<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Entity(repositoryClass="App\Repository\TipoCargoAbstractRepository")
* @ORM\Table(name="tipo_cargo", schema="perseo")
* @ORM\InheritanceType("SINGLE_TABLE")
* @ORM\DiscriminatorColumn(name="type", type="string")
* @ORM\DiscriminatorMap({
* "servicio":"App\Entity\TipoCargoServicio",
* "mejora":"App\Entity\TipoCargoMejora"
* })
* @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=true)
*/
Abstract class TipoCargoAbstract
{
/**
* @ORM\Id
* @ORM\Column(type="bigint", options={"unsigned":true})
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="string", nullable=true)
*/
protected $nombre;
/**
* @ORM\Column(type="string", nullable=true)
*/
protected $descripcion;
/**
* @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\OneToMany(targetEntity="App\Entity\Gasto", mappedBy="tipoCargo")
*/
protected $gastos;
/**
* @ORM\OneToMany(targetEntity="App\Entity\CosteVenta", mappedBy="tipoCargo")
*/
protected $costesVenta;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Coste", mappedBy="tipoCargo")
*/
protected $costes;
public function __construct()
{
$this->gastos = new ArrayCollection();
$this->costesVenta = new ArrayCollection();
$this->costes = 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 getDescripcion(): ?string
{
return $this->descripcion;
}
public function setDescripcion(?string $descripcion): self
{
$this->descripcion = $descripcion;
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|Gasto[]
*/
public function getGastos(): Collection
{
return $this->gastos;
}
public function addGasto(Gasto $gasto): self
{
if (!$this->gastos->contains($gasto)) {
$this->gastos[] = $gasto;
$gasto->setTipoCargo($this);
}
return $this;
}
public function removeGasto(Gasto $gasto): self
{
if ($this->gastos->removeElement($gasto)) {
// set the owning side to null (unless already changed)
if ($gasto->getTipoCargo() === $this) {
$gasto->setTipoCargo(null);
}
}
return $this;
}
/**
* @return Collection|CosteVenta[]
*/
public function getCostesVenta(): Collection
{
return $this->costesVenta;
}
public function addCostesVentum(CosteVenta $costesVentum): self
{
if (!$this->costesVenta->contains($costesVentum)) {
$this->costesVenta[] = $costesVentum;
$costesVentum->setTipoCargo($this);
}
return $this;
}
public function removeCostesVentum(CosteVenta $costesVentum): self
{
if ($this->costesVenta->removeElement($costesVentum)) {
// set the owning side to null (unless already changed)
if ($costesVentum->getTipoCargo() === $this) {
$costesVentum->setTipoCargo(null);
}
}
return $this;
}
/**
* @return Collection|Coste[]
*/
public function getCostes(): Collection
{
return $this->costes;
}
public function addCoste(Coste $coste): self
{
if (!$this->costes->contains($coste)) {
$this->costes[] = $coste;
$coste->setTipoCargo($this);
}
return $this;
}
public function removeCoste(Coste $coste): self
{
if ($this->costes->removeElement($coste)) {
// set the owning side to null (unless already changed)
if ($coste->getTipoCargo() === $this) {
$coste->setTipoCargo(null);
}
}
return $this;
}
}