src/Entity/Activity.php line 27
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping\Id;
use Doctrine\ORM\Mapping\Index;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\Table;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\JoinColumn;
use Doctrine\ORM\Mapping\ManyToOne;
use Doctrine\ORM\Mapping\OneToOne;
use Doctrine\ORM\Mapping\OneToMany;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\HasLifecycleCallbacks;
use Doctrine\ORM\Mapping\PrePersist;
use Doctrine\ORM\Mapping\PreUpdate;
use Doctrine\ORM\Mapping\OrderBy;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Activity
*/
#[Entity(repositoryClass: \App\Entity\ActivityRepository::class)]
#[HasLifecycleCallbacks]
#[Table(name: 'vehicle_rts_activities')]
class Activity
{
/**
* @var integer
*/
#[Column(name: 'activity_id', type: 'integer', nullable: false)]
#[Id]
#[GeneratedValue(strategy: 'IDENTITY')]
private $activityId;
/**
* @var string
*/
#[Column(name: 'activity_type', type: 'string', nullable: true, columnDefinition: "enum('Transport_And_Store','Transport_To_Distination','Store_Only')")]
private $activityType;
/**
* available request types
*/
const ACTIVITY_TYPES = array(
'Transport_And_Store_Activity' => 'Transport_And_Store',
'Transport_To_Distination_Activity' => 'Transport_To_Distination',
'Store_Only_Activity' => 'Store_Only'
);
/**
* @var boolean
*/
#[Column(name: 'is_include_revoke', type: 'boolean', nullable: true)]
private $isIncludeRevoke;
/**
* @var string
*/
#[Column(name: 'notes', type: 'text', length: 65535, nullable: true)]
private $notes;
/**
* @var \DateTime
*
*/
#[Column(name: 'activity_date', type: 'datetime', nullable: true)]
private $activityDate;
/**
* @var \DateTime
*/
#[Column(name: 'created_at', type: 'datetime', nullable: true)]
#[OrderBy(['createdAt' => 'DESC'])]
private $createdAt;
/**
* @var \DateTime
*/
#[Column(name: 'updated_at', type: 'datetime', nullable: true)]
private $updatedAt;
/**
* @var boolean
*/
#[Column(name: 'is_deleted', type: 'boolean', nullable: true)]
private $isDeleted;
/**
* @var \Users
*/
#[ManyToOne(targetEntity: \Users::class)]
#[JoinColumn(name: 'created_by', referencedColumnName: 'user_id')]
private $createdBy;
/**
* @var \Users
*/
#[ManyToOne(targetEntity: \Users::class)]
#[JoinColumn(name: 'updated_by', referencedColumnName: 'user_id')]
private $updatedBy;
/**
* @var \VehicleRevokeRequests
*/
#[ManyToOne(targetEntity: \VehicleRevokeRequests::class, inversedBy: 'rtsActivities')]
#[JoinColumn(name: 'revoke_request_id', referencedColumnName: 'request_id')]
private $revokeRequest;
/**
* @var \Vehicles
*/
#[ManyToOne(targetEntity: \Vehicles::class)]
#[JoinColumn(name: 'vehicle_id', referencedColumnName: 'vehicle_id')]
private $vehicle;
/**
* @var activityDestination
*/
#[OneToOne(targetEntity: \ActivityDestination::class, mappedBy: 'destinationActivity', cascade: ['all'])]
private $activityDestination;
/**
* @var activityEstmateVal
*/
#[OneToOne(targetEntity: \VehicleRtsActivitiesEstimateVal::class, mappedBy: 'activity', cascade: ['all'])]
private $activityEstmateVal;
/**
* @var activityStorage
*/
#[OneToOne(targetEntity: \VehicleRtsActivityStorage::class, mappedBy: 'activity', cascade: ['all'])]
#[Assert\Valid]
private $activityStorage;
/**
* @var activityTransport
*/
#[OneToOne(targetEntity: \VehicleRtsActivityTransports::class, mappedBy: 'activity', cascade: ['all'])]
private $activityTransport;
/**
* @var activityInvoice
*/
#[OneToMany(targetEntity: \VehicleRtsActivitiesInvoices::class, mappedBy: 'activity', cascade: ['all'])]
private $activityInvoice;
/**
* @var activityInventory
*/
#[OneToOne(targetEntity: \VehicleRtsActivitiesInventories::class, mappedBy: 'inventoryActivity', cascade: ['all'])]
private $activityInventory;
/**
* Get activityId
*
* @return integer
*/
public function getActivityId()
{
return $this->activityId;
}
/**
* Set activityType
*
* @param integer $activityType
*
* @return Activity
*/
public function setActivityType($activityType)
{
$this->activityType = $activityType;
return $this;
}
/**
* Get activityType
*
* @return integer
*/
public function getActivityType()
{
return $this->activityType;
}
/**
* Set isIncludeRevoke
*
* @param boolean $isIncludeRevoke
*
* @return Activity
*/
public function setIsIncludeRevoke($isIncludeRevoke)
{
$this->isIncludeRevoke = $isIncludeRevoke;
return $this;
}
/**
* Get isIncludeRevoke
*
* @return boolean
*/
public function getIsIncludeRevoke()
{
return $this->isIncludeRevoke;
}
/**
* Set notes
*
* @param string $notes
*
* @return Activity
*/
public function setNotes($notes)
{
$this->notes = $notes;
return $this;
}
/**
* Get notes
*
* @return string
*/
public function getNotes()
{
return $this->notes;
}
/**
* Set activityDate
*
* @param \DateTime $activityDate
*
* @return Activity
*/
public function setActivityDate($activityDate)
{
$this->activityDate = $activityDate;
return $this;
}
/**
* Get activityDate
*
* @return \DateTime
*/
public function getActivityDate()
{
return $this->activityDate;
}
/**
* Set createdAt
*
* @param \DateTime $createdAt
*
* @return Activity
*/
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* Set updatedAt
*
* @param \DateTime $updatedAt
*
* @return Activity
*/
public function setUpdatedAt($updatedAt)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* Get updatedAt
*
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
/**
* Set isDeleted
*
* @param boolean $isDeleted
*
* @return Activity
*/
public function setIsDeleted($isDeleted)
{
$this->isDeleted = $isDeleted;
return $this;
}
/**
* Get isDeleted
*
* @return boolean
*/
public function getIsDeleted()
{
return $this->isDeleted;
}
/**
* Set createdBy
*
*
* @return Activity
*/
public function setCreatedBy(\App\Entity\Users $createdBy = null)
{
$this->createdBy = $createdBy;
return $this;
}
/**
* Get createdBy
*
* @return \App\Entity\Users
*/
public function getCreatedBy()
{
return $this->createdBy;
}
/**
* Set updatedBy
*
*
* @return Activity
*/
public function setUpdatedBy(\App\Entity\Users $updatedBy = null)
{
$this->updatedBy = $updatedBy;
return $this;
}
/**
* Get updatedBy
*
* @return \App\Entity\Users
*/
public function getUpdatedBy()
{
return $this->updatedBy;
}
/**
* Set revokeRequest
*
*
* @return Activity
*/
public function setRevokeRequest(\App\Entity\VehicleRevokeRequests $revokeRequest = null)
{
$this->revokeRequest = $revokeRequest;
return $this;
}
/**
* Get revokeRequest
*
* @return \App\Entity\VehicleRevokeRequests
*/
public function getRevokeRequest()
{
return $this->revokeRequest;
}
/**
* Set vehicle
*
*
* @return Activity
*/
public function setVehicle(\App\Entity\Vehicles $vehicle = null)
{
$this->vehicle = $vehicle;
return $this;
}
/**
* Get vehicle
*
* @return \App\Entity\Vehicles
*/
public function getVehicle()
{
return $this->vehicle;
}
/**
* Set activityDestination
*
*
* @return Activity
*/
public function setActivityDestination(\App\Entity\ActivityDestination $activityDestination = null)
{
$this->activityDestination = $activityDestination;
$activityDestination->setDestinationActivity($this);
return $this;
}
/**
* Get activityDestination
*
* @return \App\Entity\activityDestination
*/
public function getActivityDestination()
{
return $this->activityDestination;
}
/**
* Set activityEstmateVal
*
*
* @return Activity
*/
public function setActivityEstmateVal(\App\Entity\VehicleRtsActivitiesEstimateVal $activityEstmateVal = null)
{
$this->activityEstmateVal = $activityEstmateVal;
$activityEstmateVal->setActivity($this);
return $this;
}
/**
* Get activityEstmateVal
*
* @return \App\Entity\VehicleRtsActivitiesEstimateVal
*/
public function getActivityEstmateVal()
{
return $this->activityEstmateVal;
}
/**
* Set activityStorage
*
*
* @return Activity
*/
public function setActivityStorage(\App\Entity\VehicleRtsActivityStorage $activityStorage = null)
{
$this->activityStorage = $activityStorage;
$activityStorage->setActivity($this);
return $this;
}
/**
* Get activityStorage
*
* @return \App\Entity\VehicleRtsActivityStorage
*/
public function getActivityStorage()
{
return $this->activityStorage;
}
/**
* Set activityTransport
*
*
* @return Activity
*/
public function setActivityTransport(\App\Entity\VehicleRtsActivityTransports $activityTransport = null)
{
$this->activityTransport = $activityTransport;
$activityTransport->setActivity($this);
return $this;
}
/**
* Get activityTransport
*
* @return \App\Entity\VehicleRtsActivityTransports
*/
public function getActivityTransport()
{
return $this->activityTransport;
}
/**
* Set activityInvoice
*
*
* @return Activity
*/
public function setActivityInvoice(\App\Entity\VehicleRtsActivitiesInvoices $activityInvoice = null)
{
$this->activityInvoice = $activityInvoice;
return $this;
}
/**
* Set activityInvoice
*
*
* @return VehicleRtsActivitiesInvoices
*/
public function addActivityInvoice(\App\Entity\VehicleRtsActivitiesInvoices $activityInvoice = null)
{
$activityInvoice->setActivity($this);
$this->activityInvoice = new \Doctrine\Common\Collections\ArrayCollection();
$this->activityInvoice->add($activityInvoice);
return $this;
}
/**
* Remove activityInvoice
*/
public function removeActivityInvoice(\App\Entity\VehicleRtsActivitiesInvoices $activityInvoice)
{
$this->activityInvoice->removeElement($activityInvoice);
}
/**
* Get activityInvoice
*
* @return \App\Entity\VehicleRtsActivitiesInvoices
*/
public function getActivityInvoice()
{
return $this->activityInvoice;
}
/**
* Set supplierInvoice
*
*
* @return Activity
*/
public function setSupplierInvoice(SupplierInvoices $supplierInvoice)
{
$this->activityInvoice->setRtsInvoice($supplierInvoice);
return $this;
}
/**
* Get supplierInvoice
*
* @return \App\Entity\SupplierInvoices
*/
public function getSupplierInvoice()
{
return $this->activityInvoice->getRtsInvoice();
}
/**
* Set activityInventory
*
*
* @return Activity
*/
public function setActivityInventory(VehicleRtsActivitiesInventories $activityInventory = null)
{
$this->activityInventory = $activityInventory;
if ($activityInventory instanceof \App\Entity\VehicleRtsActivitiesInventories) {
$activityInventory->setInventoryActivity($this);
}
return $this;
}
/**
* Get activityInventory
*
* @return \App\Entity\VehicleRtsActivitiesInventories
*/
public function getActivityInventory()
{
return $this->activityInventory;
}
/**
* Tasks to do before insertion
*/
#[PrePersist]
public function prePersist() {
if ($this->getCreatedAt() == null) {
$this->setCreatedAt(new \DateTime(date('Y-m-d H:i:s')));
}
}
#[PreUpdate]
public function preUpdate() {
$this->setUpdatedAt(new \DateTime(date('Y-m-d H:i:s')));
}
}