src/Entity/VehicleDocs.php line 32

  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping\Id;
  4. use Doctrine\ORM\Mapping\Index;
  5. use Doctrine\ORM\Mapping\Entity;
  6. use Doctrine\ORM\Mapping\Table;
  7. use Doctrine\ORM\Mapping\Column;
  8. use Doctrine\ORM\Mapping\JoinColumn;
  9. use Doctrine\ORM\Mapping\ManyToOne;
  10. use Doctrine\ORM\Mapping\OneToOne;
  11. use Doctrine\ORM\Mapping\OneToMany;
  12. use Doctrine\ORM\Mapping\GeneratedValue;
  13. use Doctrine\ORM\Mapping\HasLifecycleCallbacks;
  14. use Doctrine\ORM\Mapping\PrePersist;
  15. use Doctrine\ORM\Mapping\PreUpdate;
  16. use Doctrine\Common\Collections\ArrayCollection;
  17. use Symfony\Component\Validator\Constraints as Assert;
  18. //use Symfony\Component\Validator\Constraints as Assert;
  19. /**
  20.  * VehicleDocs
  21.  */
  22. #[Entity(repositoryClass\App\Entity\VehicleDocsRepository::class)]
  23. #[HasLifecycleCallbacks]
  24. #[Table(name'vehicle_docs')]
  25. #[Index(name'vehicle_id_idx'columns: ['vehicle_id'])]
  26. #[Index(name'doc_type_id_idx'columns: ['doc_type_id'])]
  27. #[Index(name'created_by_fk_idx'columns: ['created_by'])]
  28. #[Index(name'updated_by_fk_idx'columns: ['updated_by'])]
  29. class VehicleDocs
  30. {
  31.     /**
  32.      * @var integer
  33.      */
  34.     #[Column(name'doc_id'type'integer'nullablefalse)]
  35.     #[Id]
  36.     #[GeneratedValue(strategy'IDENTITY')]
  37.     private $docId;
  38.     /**
  39.      * @var integer
  40.      */
  41.     #[Column(name'received_doc_type'type'string'nullabletruecolumnDefinition"enum('no','original','copy')")]
  42.     private $receivedDocType;
  43.     /**
  44.      * available types of received documents
  45.      */
  46.     const RECEIVED_DOC_TYPES =array(
  47.         'Not Available' => 'Not Available',
  48.         'Original'      => 'Original',
  49.         'Copy'          => 'Copy'
  50.     );
  51.     /**
  52.      * @var string
  53.      */
  54.     #[Assert\File(maxSize'4000k'mimeTypes: ['image/png''image/jpeg'])]
  55.     #[Column(name'image_path'type'string'length100nullabletrue)]
  56.     private $imagePath;
  57.     /**
  58.      * @var string
  59.      *
  60.      */
  61.     private $imageWebPath;
  62.     /**
  63.      * @var \DateTime
  64.      */
  65.     #[Column(name'created_at'type'datetime'nullabletrue)]
  66.     private $createdAt;
  67.     /**
  68.      * @var \DateTime
  69.      */
  70.     #[Column(name'updated_at'type'datetime'nullabletrue)]
  71.     private $updatedAt;
  72.     /**
  73.      * @var \Users
  74.      */
  75.     #[ManyToOne(targetEntity\Users::class)]
  76.     #[JoinColumn(name'created_by'referencedColumnName'user_id')]
  77.     private $createdBy;
  78.     /**
  79.      * @var \VehicleDocTypes
  80.      */
  81.     #[ManyToOne(targetEntity\VehicleDocTypes::class)]
  82.     #[JoinColumn(name'doc_type_id'referencedColumnName'doc_type_id')]
  83.     private $docType;
  84.     /**
  85.      * @var \Users
  86.      */
  87.     #[ManyToOne(targetEntity\Users::class)]
  88.     #[JoinColumn(name'updated_by'referencedColumnName'user_id')]
  89.     private $updatedBy;
  90.     /**
  91.      * @var \Vehicles
  92.      */
  93.     #[ManyToOne(targetEntity\Vehicles::class, inversedBy'vehicleDocument'cascade: ['merge'])]
  94.     #[JoinColumn(name'vehicle_id'referencedColumnName'vehicle_id')]
  95.     private $vehicle;
  96.     /**
  97.      * @var \VehicleRegistrations
  98.      */
  99.     #[OneToOne(targetEntity\VehicleRegistrations::class, mappedBy'registrationDoc')]
  100.     private $vehicleRegistrations;
  101.     /**
  102.      * @var \VehicleBeneficiaryDetails
  103.      */
  104.     #[OneToMany(targetEntity\VehicleBeneficiaryDetails::class, mappedBy'ownerPaymentDoc'cascade: ['persist'])]
  105.     private $vehicleBeneficiaryDetails;
  106.     /**
  107.      * @var \VehicleOwnershipTransfer
  108.      */
  109.     #[OneToMany(targetEntity\VehicleOwnershipTransfer::class, mappedBy'otDoc'cascade: ['persist'])]
  110.     private $vehicleOwnershipTransfer;
  111.     /**
  112.      * Get docId
  113.      *
  114.      * @return integer
  115.      */
  116.     public function getDocId()
  117.     {
  118.         return $this->docId;
  119.     }
  120.     /**
  121.      * Set receivedDocType
  122.      *
  123.      * @param string $receivedDocType
  124.      *
  125.      * @return VehicleDocs
  126.      */
  127.     public function setReceivedDocType($receivedDocType)
  128.     {
  129.         $this->receivedDocType $receivedDocType;
  130.         return $this;
  131.     }
  132.     /**
  133.      * Get receivedDocType
  134.      *
  135.      * @return string
  136.      */
  137.     public function getReceivedDocType()
  138.     {
  139.         return $this->receivedDocType;
  140.     }
  141.     /**
  142.      * Set imagePath
  143.      *
  144.      * @param string $imagePath
  145.      *
  146.      * @return VehicleDocs
  147.      */
  148.     public function setImagePath($imagePath)
  149.     {
  150.         $this->imagePath $imagePath;
  151.         return $this;
  152.     }
  153.     /**
  154.      * Get imagePath
  155.      *
  156.      * @return string
  157.      */
  158.     public function getImagePath()
  159.     {
  160.         return $this->imagePath;
  161.     }
  162.     /**
  163.      * Set imagePath
  164.      *
  165.      * @param string $imageWebPath
  166.      *
  167.      * @return VehicleDocs
  168.      */
  169.     public function setImageWebPath($imageWebPath)
  170.     {
  171.         $this->imageWebPath $imageWebPath;
  172.     }
  173.     /**
  174.      * Get imageWebPath
  175.      *
  176.      * @return string
  177.      */
  178.     public function getImageWebPath()
  179.     {
  180.         return $this->imageWebPath;
  181.     }
  182.     /**
  183.      * Set createdAt
  184.      *
  185.      * @param \DateTime $createdAt
  186.      *
  187.      * @return VehicleDocs
  188.      */
  189.     public function setCreatedAt($createdAt)
  190.     {
  191.         $this->createdAt $createdAt;
  192.         return $this;
  193.     }
  194.     /**
  195.      * Get createdAt
  196.      *
  197.      * @return \DateTime
  198.      */
  199.     public function getCreatedAt()
  200.     {
  201.         return $this->createdAt;
  202.     }
  203.     /**
  204.      * Set updatedAt
  205.      *
  206.      * @param \DateTime $updatedAt
  207.      *
  208.      * @return VehicleDocs
  209.      */
  210.     public function setUpdatedAt($updatedAt)
  211.     {
  212.         $this->updatedAt $updatedAt;
  213.         return $this;
  214.     }
  215.     /**
  216.      * Get updatedAt
  217.      *
  218.      * @return \DateTime
  219.      */
  220.     public function getUpdatedAt()
  221.     {
  222.         return $this->updatedAt;
  223.     }
  224.     /**
  225.      * Set createdBy
  226.      *
  227.      *
  228.      * @return VehicleDocs
  229.      */
  230.     public function setCreatedBy(\App\Entity\Users $createdBy null)
  231.     {
  232.         $this->createdBy $createdBy;
  233.         return $this;
  234.     }
  235.     /**
  236.      * Get createdBy
  237.      *
  238.      * @return \App\Entity\Users
  239.      */
  240.     public function getCreatedBy()
  241.     {
  242.         return $this->createdBy;
  243.     }
  244.     /**
  245.      * Set docType
  246.      *
  247.      *
  248.      * @return VehicleDocs
  249.      */
  250.     public function setDocType(\App\Entity\VehicleDocTypes $docType null)
  251.     {
  252.         $this->docType $docType;
  253.         return $this;
  254.     }
  255.     /**
  256.      * Get docType
  257.      *
  258.      * @return \App\Entity\VehicleDocTypes
  259.      */
  260.     public function getDocType()
  261.     {
  262.         return $this->docType;
  263.     }
  264.     /**
  265.      * Set updatedBy
  266.      *
  267.      *
  268.      * @return VehicleDocs
  269.      */
  270.     public function setUpdatedBy(\App\Entity\Users $updatedBy null)
  271.     {
  272.         $this->updatedBy $updatedBy;
  273.         return $this;
  274.     }
  275.     /**
  276.      * Get updatedBy
  277.      *
  278.      * @return \App\Entity\Users
  279.      */
  280.     public function getUpdatedBy()
  281.     {
  282.         return $this->updatedBy;
  283.     }
  284.     /**
  285.      * Set vehicle
  286.      *
  287.      *
  288.      * @return VehicleDocs
  289.      */
  290.     public function setVehicle(\App\Entity\Vehicles $vehicle null)
  291.     {
  292.         $this->vehicle $vehicle;
  293.         return $this;
  294.     }
  295.     /**
  296.      * Get vehicle
  297.      *
  298.      * @return \App\Entity\Vehicles
  299.      */
  300.     public function getVehicle()
  301.     {
  302.         return $this->vehicle;
  303.     }
  304.     /**
  305.      * Set vehicleRegistrations
  306.      *
  307.      *
  308.      * @return VehicleDocs
  309.      */
  310.     public function setVehicleRegistrations(\App\Entity\VehicleRegistrations $vehicleRegistrations null)
  311.     {
  312.         $this->vehicleRegistrations$vehicleRegistrations;
  313.         return $this;
  314.     }
  315.     /**
  316.      * Get vehicleRegistrations
  317.      *
  318.      * @return \App\Entity\VehicleRegistrations
  319.      */
  320.     public function getVehicleRegistrations()
  321.     {
  322.         return $this->vehicleRegistrations;
  323.     }
  324.     /**
  325.      * Set vehicleBeneficiaryDetails
  326.      *
  327.      *
  328.      * @return VehicleDocs
  329.      */
  330.     public function addVehicleBeneficiaryDetails(\App\Entity\VehicleBeneficiaryDetails $vehicleBeneficiaryDetails null)
  331.     {
  332.         $vehicleBeneficiaryDetails->setOwnerPaymentDoc($this);
  333.         $this->vehicleBeneficiaryDetails->add($vehicleBeneficiaryDetails);
  334.         return $this;
  335.     }
  336.     /**
  337.      * Remove vehicleBeneficiaryDetails
  338.      *
  339.      * @param \App\Entity\VehicleDocs $vehicleBeneficiaryDetails
  340.      */
  341.     public function removeVehicleBeneficiaryDetails(\App\Entity\VehicleBeneficiaryDetails $vehicleBeneficiaryDetails)
  342.     {
  343.         $this->vehicleBeneficiaryDetails->removeElement($vehicleBeneficiaryDetails);
  344.     }
  345.     /**
  346.      * Get vehicleBeneficiaryDetails
  347.      *
  348.      * @return \App\Entity\VehicleBeneficiaryDetails
  349.      */
  350.     public function getVehicleBeneficiaryDetails()
  351.     {
  352.         return $this->vehicleBeneficiaryDetails;
  353.     }
  354.     /**
  355.      * Add vehicleOwnershipTransfer
  356.      *
  357.      *
  358.      * @return VehicleDocs
  359.      */
  360.     public function addVehicleOwnershipTransfer(\App\Entity\VehicleOwnershipTransfer $vehicleOwnershipTransfer null)
  361.     {
  362.         $vehicleOwnershipTransfer->setOtDoc($this);
  363.         $this->vehicleOwnershipTransfer->add($vehicleOwnershipTransfer);
  364.         return $this;
  365.     }
  366.     /**
  367.      * Remove vehicleOwnershipTransfer
  368.      *
  369.      * @param \App\Entity\VehicleDocs $vehicleOwnershipTransfer
  370.      */
  371.     public function removeVehicleOwnershipTransfer(\App\Entity\VehicleOwnershipTransfer $vehicleOwnershipTransfer)
  372.     {
  373.         $this->vehicleOwnershipTransfer->removeElement($vehicleOwnershipTransfer);
  374.     }
  375.     /**
  376.      * Get vehicleOwnershipTransfer
  377.      *
  378.      * @return \App\Entity\VehicleOwnershipTransfer
  379.      */
  380.     public function getVehicleOwnershipTransfer()
  381.     {
  382.         return $this->vehicleOwnershipTransfer;
  383.     }
  384.     #[PrePersist]
  385.     public function prePersist() {
  386.         if ($this->getCreatedAt() == null) {
  387.             $this->setCreatedAt(new \DateTime(date('Y-m-d H:i:s')));
  388.         }
  389.     }
  390.     #[PreUpdate]
  391.     public function preUpdate() {
  392.         $this->setUpdatedAt(new \DateTime(date('Y-m-d H:i:s')));
  393.     }
  394. }