<?php
namespace App\Entity;
// use App\Repository\LineasRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @Gedmo\Tree(type="nested")
* use repository for handy tree functions
* @ORM\Entity(repositoryClass="Gedmo\Tree\Entity\Repository\NestedTreeRepository")
*/
class Lineas
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $createAt;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $codarticulo;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Assert\Length(max=35)
*/
private $descripcion;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $codfavorito;
/**
* @ORM\Column(type="decimal", precision=10, scale=0, nullable=true)
*/
private $precio;
/**
* @ORM\Column(type="decimal", precision=10, scale=0, nullable=true)
*/
private $preciosiniva;
/**
* @ORM\Column(type="decimal", precision=10, scale=0, nullable=true)
*/
private $precioiva;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $codimpuesto;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $codmodificador;
/**
* @ORM\ManyToOne(targetEntity=cabecera::class, inversedBy="lineas")
*/
private $cabecera;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $numlineasmodif;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $codfavoritos;
/**
* @Gedmo\TreeLeft
* @ORM\Column(name="lft", type="integer")
*/
private $lft;
/**
* @Gedmo\TreeLevel
* @ORM\Column(name="lvl", type="integer")
*/
private $lvl;
/**
* @Gedmo\TreeRight
* @ORM\Column(name="rgt", type="integer")
*/
private $rgt;
/**
* @Gedmo\TreeRoot
* @ORM\ManyToOne(targetEntity="Lineas")
* @ORM\JoinColumn(name="tree_root", referencedColumnName="id", onDelete="CASCADE")
*/
private $root;
/**
* @Gedmo\TreeParent
* @ORM\ManyToOne(targetEntity="Lineas", inversedBy="children")
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id", onDelete="CASCADE")
*/
private $parent;
/**
* @ORM\OneToMany(targetEntity="Lineas", mappedBy="parent")
* @ORM\OrderBy({"lft" = "ASC"})
*/
private $children;
/**
* @ORM\Column(type="integer")
*/
private $unidades = 1;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $preciototal;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $posicion;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $preciounidad;
public function __construct()
{
$this->children = new ArrayCollection();
}
public function __toString()
{
return $this->getDescripcion();
}
public function getId(): ?int
{
return $this->id;
}
public function getCreateAt(): ?\DateTimeInterface
{
return $this->createAt;
}
public function setCreateAt(?\DateTimeInterface $createAt): self
{
$this->createAt = $createAt;
return $this;
}
public function getCodarticulo(): ?int
{
return $this->codarticulo;
}
public function setCodarticulo(?int $codarticulo): self
{
$this->codarticulo = $codarticulo;
return $this;
}
public function getDescripcion(): ?string
{
return $this->descripcion;
}
public function setDescripcion(?string $descripcion): self
{
$this->descripcion = $descripcion;
return $this;
}
public function getCodfavorito(): ?int
{
return $this->codfavorito;
}
public function setCodfavorito(?int $codfavorito): self
{
$this->codfavorito = $codfavorito;
return $this;
}
public function getPrecio(): ?string
{
return $this->precio;
}
public function setPrecio(?string $precio): self
{
$this->precio = $precio;
return $this;
}
public function getPreciosiniva(): ?string
{
return $this->preciosiniva;
}
public function setPreciosiniva(?string $preciosiniva): self
{
$this->preciosiniva = $preciosiniva;
return $this;
}
public function getPrecioiva(): ?string
{
return $this->precioiva;
}
public function setPrecioiva(?string $precioiva): self
{
$this->precioiva = $precioiva;
return $this;
}
public function getCodimpuesto(): ?int
{
return $this->codimpuesto;
}
public function setCodimpuesto(?int $codimpuesto): self
{
$this->codimpuesto = $codimpuesto;
return $this;
}
public function getCodmodificador(): ?int
{
return $this->codmodificador;
}
public function setCodmodificador(?int $codmodificador): self
{
$this->codmodificador = $codmodificador;
return $this;
}
public function getNumlineasmodif(): ?int
{
return $this->numlineasmodif;
}
public function setNumlineasmodif(?int $numlineasmodif): self
{
$this->numlineasmodif = $numlineasmodif;
return $this;
}
public function getCodfavoritos(): ?int
{
return $this->codfavoritos;
}
public function setCodfavoritos(?int $codfavoritos): self
{
$this->codfavoritos = $codfavoritos;
return $this;
}
public function getLft(): ?int
{
return $this->lft;
}
public function setLft(int $lft): self
{
$this->lft = $lft;
return $this;
}
public function getLvl(): ?int
{
return $this->lvl;
}
public function setLvl(int $lvl): self
{
$this->lvl = $lvl;
return $this;
}
public function getRgt(): ?int
{
return $this->rgt;
}
public function setRgt(int $rgt): self
{
$this->rgt = $rgt;
return $this;
}
public function getCabecera(): ?cabecera
{
return $this->cabecera;
}
public function setCabecera(?cabecera $cabecera): self
{
$this->cabecera = $cabecera;
return $this;
}
public function getRoot(): ?self
{
return $this->root;
}
public function setRoot(?self $root): self
{
$this->root = $root;
return $this;
}
public function getParent(): ?self
{
return $this->parent;
}
public function setParent(?self $parent): self
{
$this->parent = $parent;
return $this;
}
/**
* @return Collection|Lineas[]
*/
public function getChildren(): Collection
{
return $this->children;
}
public function addChild(Lineas $child): self
{
if (!$this->children->contains($child)) {
$this->children[] = $child;
$child->setParent($this);
}
return $this;
}
public function removeChild(Lineas $child): self
{
if ($this->children->removeElement($child)) {
// set the owning side to null (unless already changed)
if ($child->getParent() === $this) {
$child->setParent(null);
}
}
return $this;
}
public function getUnidades(): ?int
{
return $this->unidades;
}
public function setUnidades(int $unidades): self
{
$this->unidades = $unidades;
return $this;
}
public function getPreciototal(): ?int
{
return $this->preciototal;
}
public function setPreciototal(?int $preciototal): self
{
$this->preciototal = $preciototal;
return $this;
}
public function getPosicion(): ?int
{
return $this->posicion;
}
public function setPosicion(?int $posicion): self
{
$this->posicion = $posicion;
return $this;
}
public function getPreciounidad(): ?int
{
return $this->preciounidad;
}
public function setPreciounidad(?int $preciounidad): self
{
$this->preciounidad = $preciounidad;
return $this;
}
}