src/Entity/Activity.php line 27

  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\ORM\Mapping\OrderBy;
  17. use Symfony\Component\Validator\Constraints as Assert;
  18. /**
  19.  * Activity
  20.  */
  21. #[Entity(repositoryClass\App\Entity\ActivityRepository::class)]
  22. #[HasLifecycleCallbacks]
  23. #[Table(name'vehicle_rts_activities')]
  24. class Activity
  25. {
  26.     /**
  27.      * @var integer
  28.      */
  29.     #[Column(name'activity_id'type'integer'nullablefalse)]
  30.     #[Id]
  31.     #[GeneratedValue(strategy'IDENTITY')]
  32.     private $activityId;
  33.     
  34.     /**
  35.      * @var string
  36.      */
  37.     #[Column(name'activity_type'type'string'nullabletruecolumnDefinition"enum('Transport_And_Store','Transport_To_Distination','Store_Only')")]
  38.     private $activityType;
  39.     
  40.     /**
  41.      * available request types
  42.      */
  43.     const ACTIVITY_TYPES = array(
  44.         'Transport_And_Store_Activity'      => 'Transport_And_Store',
  45.         'Transport_To_Distination_Activity' => 'Transport_To_Distination',
  46.         'Store_Only_Activity'               => 'Store_Only'
  47.     );
  48.     
  49.     /**
  50.      * @var boolean
  51.      */
  52.     #[Column(name'is_include_revoke'type'boolean'nullabletrue)]
  53.     private $isIncludeRevoke;
  54.     /**
  55.      * @var string
  56.      */
  57.     #[Column(name'notes'type'text'length65535nullabletrue)]
  58.     private $notes;
  59.     
  60.     /**
  61.      * @var \DateTime
  62.      *
  63.      */
  64.     #[Column(name'activity_date'type'datetime'nullabletrue)]
  65.     private $activityDate;
  66.     
  67.     /**
  68.      * @var \DateTime
  69.      */
  70.     #[Column(name'created_at'type'datetime'nullabletrue)]
  71.     #[OrderBy(['createdAt' => 'DESC'])]
  72.     private $createdAt;
  73.     /**
  74.      * @var \DateTime
  75.      */
  76.     #[Column(name'updated_at'type'datetime'nullabletrue)]
  77.     private $updatedAt;
  78.     
  79.     /**
  80.      * @var boolean
  81.      */
  82.     #[Column(name'is_deleted'type'boolean'nullabletrue)]
  83.     private $isDeleted;
  84.     
  85.     /**
  86.      * @var \Users
  87.      */
  88.     #[ManyToOne(targetEntity\Users::class)]
  89.     #[JoinColumn(name'created_by'referencedColumnName'user_id')]
  90.     private $createdBy;
  91.     
  92.     /**
  93.      * @var \Users
  94.      */
  95.     #[ManyToOne(targetEntity\Users::class)]
  96.     #[JoinColumn(name'updated_by'referencedColumnName'user_id')]
  97.     private $updatedBy;
  98.     
  99.     /**
  100.      * @var \VehicleRevokeRequests
  101.      */
  102.     #[ManyToOne(targetEntity\VehicleRevokeRequests::class, inversedBy'rtsActivities')]
  103.     #[JoinColumn(name'revoke_request_id'referencedColumnName'request_id')]
  104.     private $revokeRequest;
  105.     /**
  106.      * @var \Vehicles
  107.      */
  108.     #[ManyToOne(targetEntity\Vehicles::class)]
  109.     #[JoinColumn(name'vehicle_id'referencedColumnName'vehicle_id')]
  110.     private $vehicle;
  111.     /**
  112.      * @var activityDestination
  113.      */
  114.     #[OneToOne(targetEntity\ActivityDestination::class, mappedBy'destinationActivity'cascade: ['all'])]
  115.     private $activityDestination;
  116.     
  117.     /**
  118.      * @var activityEstmateVal
  119.      */
  120.     #[OneToOne(targetEntity\VehicleRtsActivitiesEstimateVal::class, mappedBy'activity'cascade: ['all'])]
  121.     private $activityEstmateVal;
  122.     
  123.     /**
  124.      * @var activityStorage
  125.      */
  126.     #[OneToOne(targetEntity\VehicleRtsActivityStorage::class, mappedBy'activity'cascade: ['all'])]
  127.     #[Assert\Valid]
  128.     private $activityStorage;
  129.     
  130.     /**
  131.      * @var activityTransport
  132.      */
  133.     #[OneToOne(targetEntity\VehicleRtsActivityTransports::class, mappedBy'activity'cascade: ['all'])]
  134.     private $activityTransport;
  135.     
  136.     /**
  137.      * @var activityInvoice
  138.      */
  139.     #[OneToMany(targetEntity\VehicleRtsActivitiesInvoices::class, mappedBy'activity'cascade: ['all'])]
  140.     private $activityInvoice;
  141.     /**
  142.      * @var activityInventory
  143.      */
  144.     #[OneToOne(targetEntity\VehicleRtsActivitiesInventories::class, mappedBy'inventoryActivity'cascade: ['all'])]
  145.     private $activityInventory;
  146.     /**
  147.      * Get activityId
  148.      *
  149.      * @return integer
  150.      */
  151.     public function getActivityId()
  152.     {
  153.         return $this->activityId;
  154.     }
  155.     
  156.     /**
  157.      * Set activityType
  158.      *
  159.      * @param integer $activityType
  160.      *
  161.      * @return Activity
  162.      */
  163.     public function setActivityType($activityType)
  164.     {
  165.         $this->activityType $activityType;
  166.         return $this;
  167.     }
  168.     /**
  169.      * Get activityType
  170.      *
  171.      * @return integer
  172.      */
  173.     public function getActivityType()
  174.     {
  175.         return $this->activityType;
  176.     }
  177.     /**
  178.      * Set isIncludeRevoke
  179.      *
  180.      * @param boolean $isIncludeRevoke
  181.      *
  182.      * @return Activity
  183.      */
  184.     public function setIsIncludeRevoke($isIncludeRevoke)
  185.     {
  186.         $this->isIncludeRevoke $isIncludeRevoke;
  187.         return $this;
  188.     }
  189.     /**
  190.      * Get isIncludeRevoke
  191.      *
  192.      * @return boolean
  193.      */
  194.     public function getIsIncludeRevoke()
  195.     {
  196.         return $this->isIncludeRevoke;
  197.     }
  198.     
  199.      /**
  200.      * Set notes
  201.      *
  202.      * @param string $notes
  203.      *
  204.      * @return Activity
  205.      */
  206.     public function setNotes($notes)
  207.     {
  208.         $this->notes $notes;
  209.         return $this;
  210.     }
  211.     /**
  212.      * Get notes
  213.      *
  214.      * @return string
  215.      */
  216.     public function getNotes()
  217.     {
  218.         return $this->notes;
  219.     }
  220.     
  221.     /**
  222.      * Set activityDate
  223.      *
  224.      * @param \DateTime $activityDate
  225.      *
  226.      * @return Activity
  227.      */
  228.     public function setActivityDate($activityDate)
  229.     {
  230.         $this->activityDate $activityDate;
  231.         return $this;
  232.     }
  233.     /**
  234.      * Get activityDate
  235.      *
  236.      * @return \DateTime
  237.      */
  238.     public function getActivityDate()
  239.     {
  240.         return $this->activityDate;
  241.     }
  242.     
  243.     /**
  244.      * Set createdAt
  245.      *
  246.      * @param \DateTime $createdAt
  247.      *
  248.      * @return Activity
  249.      */
  250.     public function setCreatedAt($createdAt)
  251.     {
  252.         $this->createdAt $createdAt;
  253.         return $this;
  254.     }
  255.     /**
  256.      * Get createdAt
  257.      *
  258.      * @return \DateTime
  259.      */
  260.     public function getCreatedAt()
  261.     {
  262.         return $this->createdAt;
  263.     }
  264.     /**
  265.      * Set updatedAt
  266.      *
  267.      * @param \DateTime $updatedAt
  268.      *
  269.      * @return Activity
  270.      */
  271.     public function setUpdatedAt($updatedAt)
  272.     {
  273.         $this->updatedAt $updatedAt;
  274.         return $this;
  275.     }
  276.     /**
  277.      * Get updatedAt
  278.      *
  279.      * @return \DateTime
  280.      */
  281.     public function getUpdatedAt()
  282.     {
  283.         return $this->updatedAt;
  284.     }
  285.     
  286.     /**
  287.      * Set isDeleted
  288.      *
  289.      * @param boolean $isDeleted
  290.      *
  291.      * @return Activity
  292.      */
  293.     public function setIsDeleted($isDeleted)
  294.     {
  295.         $this->isDeleted $isDeleted;
  296.         return $this;
  297.     }
  298.     /**
  299.      * Get isDeleted
  300.      *
  301.      * @return boolean
  302.      */
  303.     public function getIsDeleted()
  304.     {
  305.         return $this->isDeleted;
  306.     }
  307.     
  308.     /**
  309.      * Set createdBy
  310.      *
  311.      *
  312.      * @return Activity
  313.      */
  314.     public function setCreatedBy(\App\Entity\Users $createdBy null)
  315.     {
  316.         $this->createdBy $createdBy;
  317.         return $this;
  318.     }
  319.     /**
  320.      * Get createdBy
  321.      *
  322.      * @return \App\Entity\Users
  323.      */
  324.     public function getCreatedBy()
  325.     {
  326.         return $this->createdBy;
  327.     }
  328.     
  329.     /**
  330.      * Set updatedBy
  331.      *
  332.      *
  333.      * @return Activity
  334.      */
  335.     public function setUpdatedBy(\App\Entity\Users $updatedBy null)
  336.     {
  337.         $this->updatedBy $updatedBy;
  338.         return $this;
  339.     }
  340.     /**
  341.      * Get updatedBy
  342.      *
  343.      * @return \App\Entity\Users
  344.      */
  345.     public function getUpdatedBy()
  346.     {
  347.         return $this->updatedBy;
  348.     }
  349.     
  350.     /**
  351.      * Set revokeRequest
  352.      *
  353.      *
  354.      * @return Activity
  355.      */
  356.     public function setRevokeRequest(\App\Entity\VehicleRevokeRequests $revokeRequest null)
  357.     {
  358.         $this->revokeRequest $revokeRequest;
  359.         return $this;
  360.     }
  361.     /**
  362.      * Get revokeRequest
  363.      *
  364.      * @return \App\Entity\VehicleRevokeRequests
  365.      */
  366.     public function getRevokeRequest()
  367.     {
  368.         return $this->revokeRequest;
  369.     }
  370.     
  371.     /**
  372.      * Set vehicle
  373.      *
  374.      *
  375.      * @return Activity
  376.      */
  377.     public function setVehicle(\App\Entity\Vehicles $vehicle null)
  378.     {
  379.         $this->vehicle $vehicle;
  380.         return $this;
  381.     }
  382.     /**
  383.      * Get vehicle
  384.      *
  385.      * @return \App\Entity\Vehicles
  386.      */
  387.     public function getVehicle()
  388.     {
  389.         return $this->vehicle;
  390.     }
  391.     
  392.     /**
  393.      * Set activityDestination
  394.      *
  395.      *
  396.      * @return Activity
  397.      */
  398.     public function setActivityDestination(\App\Entity\ActivityDestination $activityDestination null)
  399.     {
  400.         $this->activityDestination $activityDestination;
  401.         $activityDestination->setDestinationActivity($this);
  402.         return $this;
  403.     }
  404.     /**
  405.      * Get activityDestination
  406.      *
  407.      * @return \App\Entity\activityDestination
  408.      */
  409.     public function getActivityDestination()
  410.     {
  411.         return $this->activityDestination;
  412.     }
  413.     
  414.     /**
  415.      * Set activityEstmateVal
  416.      *
  417.      *
  418.      * @return Activity
  419.      */
  420.     public function setActivityEstmateVal(\App\Entity\VehicleRtsActivitiesEstimateVal $activityEstmateVal null)
  421.     {
  422.         $this->activityEstmateVal $activityEstmateVal;
  423.         $activityEstmateVal->setActivity($this);
  424.         return $this;
  425.     }
  426.     /**
  427.      * Get activityEstmateVal
  428.      *
  429.      * @return \App\Entity\VehicleRtsActivitiesEstimateVal
  430.      */
  431.     public function getActivityEstmateVal()
  432.     {
  433.         return $this->activityEstmateVal;
  434.     }
  435.     
  436.     /**
  437.      * Set activityStorage
  438.      *
  439.      *
  440.      * @return Activity
  441.      */
  442.     public function setActivityStorage(\App\Entity\VehicleRtsActivityStorage $activityStorage null)
  443.     {
  444.         $this->activityStorage $activityStorage;
  445.         $activityStorage->setActivity($this);
  446.         return $this;
  447.     }
  448.     /**
  449.      * Get activityStorage
  450.      *
  451.      * @return \App\Entity\VehicleRtsActivityStorage
  452.      */
  453.     public function getActivityStorage()
  454.     {
  455.         return $this->activityStorage;
  456.     }
  457.     
  458.     /**
  459.      * Set activityTransport
  460.      *
  461.      *
  462.      * @return Activity
  463.      */
  464.     public function setActivityTransport(\App\Entity\VehicleRtsActivityTransports $activityTransport null)
  465.     {
  466.         $this->activityTransport $activityTransport;
  467.         $activityTransport->setActivity($this);
  468.         return $this;
  469.     }
  470.     /**
  471.      * Get activityTransport
  472.      *
  473.      * @return \App\Entity\VehicleRtsActivityTransports
  474.      */
  475.     public function getActivityTransport()
  476.     {
  477.         return $this->activityTransport;
  478.     }
  479.     
  480.     /**
  481.      * Set activityInvoice
  482.      *
  483.      *
  484.      * @return Activity
  485.      */
  486.     public function setActivityInvoice(\App\Entity\VehicleRtsActivitiesInvoices $activityInvoice null)
  487.     {
  488.         $this->activityInvoice $activityInvoice;
  489.         return $this;
  490.     }
  491.     
  492.     /**
  493.      * Set activityInvoice
  494.      *
  495.      *
  496.      * @return VehicleRtsActivitiesInvoices
  497.      */
  498.     public function addActivityInvoice(\App\Entity\VehicleRtsActivitiesInvoices $activityInvoice null)
  499.     {
  500.         $activityInvoice->setActivity($this);
  501.         $this->activityInvoice = new \Doctrine\Common\Collections\ArrayCollection();
  502.         $this->activityInvoice->add($activityInvoice);
  503.         return $this;
  504.     }
  505.     /**
  506.      * Remove activityInvoice
  507.      */
  508.     public function removeActivityInvoice(\App\Entity\VehicleRtsActivitiesInvoices $activityInvoice)
  509.     {
  510.         $this->activityInvoice->removeElement($activityInvoice);
  511.     }
  512.     /**
  513.      * Get activityInvoice
  514.      *
  515.      * @return \App\Entity\VehicleRtsActivitiesInvoices
  516.      */
  517.     public function getActivityInvoice()
  518.     {
  519.         return $this->activityInvoice;
  520.     }
  521.     
  522.     /**
  523.      * Set supplierInvoice
  524.      *
  525.      *
  526.      * @return Activity
  527.      */
  528.     public function setSupplierInvoice(SupplierInvoices $supplierInvoice)
  529.     {
  530.         $this->activityInvoice->setRtsInvoice($supplierInvoice);
  531.         return $this;
  532.     }
  533.     /**
  534.      * Get supplierInvoice
  535.      *
  536.      * @return \App\Entity\SupplierInvoices
  537.      */
  538.     public function getSupplierInvoice()
  539.     {
  540.         return $this->activityInvoice->getRtsInvoice();
  541.     }
  542.     /**
  543.      * Set activityInventory
  544.      *
  545.      *
  546.      * @return Activity
  547.      */
  548.     public function setActivityInventory(VehicleRtsActivitiesInventories $activityInventory null)
  549.     {
  550.         $this->activityInventory $activityInventory;
  551.         if ($activityInventory instanceof \App\Entity\VehicleRtsActivitiesInventories) {
  552.             $activityInventory->setInventoryActivity($this);
  553.         }
  554.         return $this;
  555.     }
  556.     /**
  557.      * Get activityInventory
  558.      *
  559.      * @return \App\Entity\VehicleRtsActivitiesInventories
  560.      */
  561.     public function getActivityInventory()
  562.     {
  563.         return $this->activityInventory;
  564.     }
  565.     /**
  566.      * Tasks to do before insertion
  567.      */
  568.     #[PrePersist]
  569.     public function prePersist() {
  570.         if ($this->getCreatedAt() == null) {
  571.             $this->setCreatedAt(new \DateTime(date('Y-m-d H:i:s')));
  572.         }
  573.     }
  574.     #[PreUpdate]
  575.     public function preUpdate() {
  576.         $this->setUpdatedAt(new \DateTime(date('Y-m-d H:i:s')));
  577.     }
  578. }