src/Entity/DetalleOperacion.php line 25

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Enum\TipoOperacionEnum;
  4. use DateTime;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Gedmo\Mapping\Annotation as Gedmo;
  7. use Symfony\Component\HttpFoundation\File\File;
  8. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  9. /**
  10.  * @ORM\Entity(repositoryClass="App\Repository\DetalleOperacionRepository")
  11.  * @ORM\Table(name="detalle_operacion", schema="perseo")
  12.  * @ORM\InheritanceType("SINGLE_TABLE")
  13.  * @ORM\DiscriminatorColumn(name="type", type="string")
  14.  * @ORM\DiscriminatorMap({
  15.  *     "operacion":"App\Entity\DetalleOperacion",
  16.  *     "compra":"App\Entity\DetalleCompra",
  17.  *     "venta":"App\Entity\DetalleVenta"
  18.  * })
  19.  * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=true)
  20.  * @Vich\Uploadable
  21.  */
  22. class DetalleOperacion
  23. {
  24.     /**
  25.      * @ORM\Id
  26.      * @ORM\Column(type="bigint")
  27.      * @ORM\GeneratedValue(strategy="AUTO")
  28.      */
  29.     protected $id;
  30.     /**
  31.      * @ORM\Column(type="float", nullable=true, name="precio_coste", options={"default":"0.0","unsigned":true})
  32.      */
  33.     protected $precioCoste;
  34.     /**
  35.      * @ORM\Column(type="float", nullable=true, precision=2, name="precio_promocion", options={"default":"0.00","unsigned":true})
  36.      */
  37.     protected $precioPromocion;
  38.     /**
  39.      * @ORM\Column(type="string", nullable=true, name="reloj_foto")
  40.      */
  41.     protected $relojFoto;
  42.     /**
  43.      * @Vich\UploadableField(mapping="reloj", fileNameProperty="relojFoto")
  44.      * @var File
  45.      */
  46.     protected $relojFotoFile;
  47.     /**
  48.      * @ORM\Column(type="string", nullable=true, name="reloj_modelo1")
  49.      */
  50.     protected $relojModelo1;
  51.     /**
  52.      * @ORM\Column(type="string", nullable=true)
  53.      */
  54.     private $relojModelo2;
  55.     /**
  56.      * @ORM\Column(type="string", nullable=true, name="reloj_ref1")
  57.      */
  58.     protected $relojRef1;
  59.     /**
  60.      * @ORM\Column(type="string", nullable=true)
  61.      */
  62.     private $relojRef2;
  63.     /**
  64.      * @ORM\Column(type="string", nullable=true, name="reloj_serie")
  65.      */
  66.     protected $relojSerie;
  67.     /**
  68.      * @ORM\Column(
  69.      *     type="datetime",
  70.      *     nullable=true,
  71.      *     name="reloj_fecha",
  72.      *     options={"comment":"Fecha comprado por primera vez"}
  73.      * )
  74.      */
  75.     protected $relojFecha;
  76.     /**
  77.      * @ORM\Column(type="boolean", nullable=false, name="reloj_caja", options={"default":0})
  78.      */
  79.     protected $relojCaja;
  80.     /**
  81.      * @ORM\Column(type="boolean", nullable=false, name="reloj_papeles", options={"default":0})
  82.      */
  83.     protected $relojPapeles;
  84.     /**
  85.      * @ORM\Column(
  86.      *     type="string",
  87.      *     length=4,
  88.      *     nullable=true,
  89.      *     name="reloj_regimen",
  90.      *     options={"comment":"Valores a tomar REBU รณ IVA, por defecto REBU"}
  91.      * )
  92.      */
  93.     protected $relojRegimen;
  94.     /**
  95.      * @ORM\Column(type="text", nullable=true)
  96.      */
  97.     private $comentario;
  98.     /**
  99.      * @ORM\Column(type="datetime", nullable=true, name="deleted_at")
  100.      */
  101.     protected $deletedAt;
  102.     /**
  103.      * @ORM\Column(type="datetime", nullable=false, name="updated_at", options={"default":"2022-01-01 00:00:00"})
  104.      * @Gedmo\Timestampable(on="update")
  105.      */
  106.     protected $updatedAt;
  107.     /**
  108.      * @ORM\Column(type="datetime", nullable=false, name="created_at", options={"default":"2022-01-01 00:00:00"})
  109.      * @Gedmo\Timestampable(on="create")
  110.      */
  111.     protected $createdAt;
  112.     /**
  113.      * @ORM\OneToOne(targetEntity=\App\Entity\ActividadAbstract::class, mappedBy="detalleOperacion")
  114.      */
  115.     private $actividad;
  116.     /**
  117.      * @ORM\ManyToOne(targetEntity="App\Entity\EstadoAspecto", inversedBy="detalleCompras")
  118.      * @ORM\JoinColumn(name="reloj_aspecto_id", referencedColumnName="id")
  119.      */
  120.     protected $relojAspecto;
  121.     /**
  122.      * @ORM\ManyToOne(targetEntity="App\Entity\Marca", inversedBy="detalleCompras")
  123.      * @ORM\JoinColumn(name="reloj_marca_id", referencedColumnName="id")
  124.      */
  125.     protected $relojMarca;
  126.     protected $relojFechaStr;
  127.     public function __construct()
  128.     {
  129.         $this->relojCaja false;
  130.         $this->relojPapeles false;
  131.     }
  132.     public function getId(): ?int
  133.     {
  134.         return $this->id;
  135.     }
  136.     public function getPrecioCoste(): ?float
  137.     {
  138.         return $this->precioCoste;
  139.     }
  140.     public function setPrecioCoste(?float $precioCoste): self
  141.     {
  142.         $this->precioCoste $precioCoste;
  143.         return $this;
  144.     }
  145.     public function getRelojFoto(): ?string
  146.     {
  147.         return $this->relojFoto;
  148.     }
  149.     public function setRelojFoto(?string $relojFoto): self
  150.     {
  151.         $this->relojFoto $relojFoto;
  152.         return $this;
  153.     }
  154.     public function getRelojFotoFile(): ?File
  155.     {
  156.         return $this->relojFotoFile;
  157.     }
  158.     public function setRelojFotoFile(?File $relojFotoFile): self
  159.     {
  160.         $this->relojFotoFile $relojFotoFile;
  161.         if ($relojFotoFile) {
  162.             // if 'updatedAt' is not defined in your entity, use another property
  163.             $this->setUpdatedAt(new DateTime('now'));
  164.         }
  165.         return $this;
  166.     }
  167.     public function getRelojModelo1(): ?string
  168.     {
  169.         return $this->relojModelo1;
  170.     }
  171.     public function setRelojModelo1(?string $relojModelo1): self
  172.     {
  173.         $this->relojModelo1 $relojModelo1;
  174.         return $this;
  175.     }
  176.     public function getRelojRef1(): ?string
  177.     {
  178.         return $this->relojRef1;
  179.     }
  180.     public function setRelojRef1(?string $relojRef1): self
  181.     {
  182.         $this->relojRef1 $relojRef1;
  183.         return $this;
  184.     }
  185.     public function getRelojSerie(): ?string
  186.     {
  187.         return $this->relojSerie;
  188.     }
  189.     public function setRelojSerie(?string $relojSerie): self
  190.     {
  191.         $this->relojSerie $relojSerie;
  192.         return $this;
  193.     }
  194.     public function getRelojFecha(): ?\DateTimeInterface
  195.     {
  196.         return $this->relojFecha;
  197.     }
  198.     public function setRelojFecha(?\DateTimeInterface $relojFecha): self
  199.     {
  200.         $this->relojFecha $relojFecha;
  201.         return $this;
  202.     }
  203.     public function isRelojCaja(): ?bool
  204.     {
  205.         return $this->relojCaja;
  206.     }
  207.     public function setRelojCaja(bool $relojCaja): self
  208.     {
  209.         $this->relojCaja $relojCaja;
  210.         return $this;
  211.     }
  212.     public function isRelojPapeles(): ?bool
  213.     {
  214.         return $this->relojPapeles;
  215.     }
  216.     public function setRelojPapeles(bool $relojPapeles): self
  217.     {
  218.         $this->relojPapeles $relojPapeles;
  219.         return $this;
  220.     }
  221.     public function getDeletedAt(): ?\DateTimeInterface
  222.     {
  223.         return $this->deletedAt;
  224.     }
  225.     public function setDeletedAt(?\DateTimeInterface $deletedAt): self
  226.     {
  227.         $this->deletedAt $deletedAt;
  228.         return $this;
  229.     }
  230.     public function getUpdatedAt(): ?\DateTimeInterface
  231.     {
  232.         return $this->updatedAt;
  233.     }
  234.     public function setUpdatedAt(\DateTimeInterface $updatedAt): self
  235.     {
  236.         $this->updatedAt $updatedAt;
  237.         return $this;
  238.     }
  239.     public function getCreatedAt(): ?\DateTimeInterface
  240.     {
  241.         return $this->createdAt;
  242.     }
  243.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  244.     {
  245.         $this->createdAt $createdAt;
  246.         return $this;
  247.     }
  248.     public function getRelojMarca(): ?Marca
  249.     {
  250.         return $this->relojMarca;
  251.     }
  252.     public function setRelojMarca(?Marca $relojMarca): self
  253.     {
  254.         $this->relojMarca $relojMarca;
  255.         return $this;
  256.     }
  257.     public function getRelojAspecto(): ?EstadoAspecto
  258.     {
  259.         return $this->relojAspecto;
  260.     }
  261.     public function setRelojAspecto(?EstadoAspecto $relojAspecto): self
  262.     {
  263.         $this->relojAspecto $relojAspecto;
  264.         return $this;
  265.     }
  266.     public function getRelojModelo2(): ?string
  267.     {
  268.         return $this->relojModelo2;
  269.     }
  270.     public function setRelojModelo2(?string $relojModelo2): self
  271.     {
  272.         $this->relojModelo2 $relojModelo2;
  273.         return $this;
  274.     }
  275.     public function getRelojRef2(): ?string
  276.     {
  277.         return $this->relojRef2;
  278.     }
  279.     public function setRelojRef2(?string $relojRef2): self
  280.     {
  281.         $this->relojRef2 $relojRef2;
  282.         return $this;
  283.     }
  284.     public function getRelojRegimen(): ?string
  285.     {
  286.         return $this->relojRegimen;
  287.     }
  288.     public function setRelojRegimen(?string $relojRegimen): self
  289.     {
  290.         $this->relojRegimen $relojRegimen;
  291.         return $this;
  292.     }
  293.     public function getComentario(): ?string
  294.     {
  295.         return $this->comentario;
  296.     }
  297.     public function setComentario(?string $comentario): self
  298.     {
  299.         $this->comentario $comentario;
  300.         return $this;
  301.     }
  302.     public function getPrecioPromocion(): ?float
  303.     {
  304.         return $this->precioPromocion;
  305.     }
  306.     public function setPrecioPromocion(?float $precioPromocion): static
  307.     {
  308.         $this->precioPromocion $precioPromocion;
  309.         return $this;
  310.     }
  311.     public function getActividad(): ?ActividadAbstract
  312.     {
  313.         return $this->actividad;
  314.     }
  315.     public function setActividad(?ActividadAbstract $actividad): static
  316.     {
  317.         // unset the owning side of the relation if necessary
  318.         if ($actividad === null && $this->actividad !== null) {
  319.             $this->actividad->setDetalleOperacion(null);
  320.         }
  321.         // set the owning side of the relation if necessary
  322.         if ($actividad !== null && $actividad->getDetalleOperacion() !== $this) {
  323.             $actividad->setDetalleOperacion($this);
  324.         }
  325.         $this->actividad $actividad;
  326.         return $this;
  327.     }
  328.     public function getType(): ?string
  329.     {
  330.         $type null;
  331.         if($this instanceof DetalleCompra$type TipoOperacionEnum::OPERACION_COMPRA;
  332.         if($this instanceof DetalleVenta$type TipoOperacionEnum::OPERACION_VENTA;
  333.         return $type;
  334.     }
  335.     public function getOperacion(): ?Operacion
  336.     {
  337.         $operacion null;
  338.         if($this instanceof DetalleCompra$operacion $this->getCompra()->getOperacion();
  339.         if($this instanceof DetalleVenta$operacion $this->getVenta()->getOperacion();
  340.         return $operacion;
  341.     }
  342.     public function getRelojFechaStr(): ?string
  343.     {
  344.         return $this->relojFecha?->format("d/m/Y");
  345.     }
  346. }