<?php
namespace App\Entity;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
/**
* Class ProductSalesUnit
*
* @ORM\Entity
* @ORM\Table(name="malys_product_sales_unit")
* @ORM\HasLifecycleCallbacks()
* @package App\Entity
*/
class ProductSalesUnit
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @var string
*
* @ORM\Column(name="label", type="string", length=255, nullable=false)
*/
protected $label;
/**
* @var DateTime
*
* @ORM\Column(name="created_at", type="datetime", nullable=false)
*/
protected $createdAt;
/**
* @var DateTime
*
* @ORM\Column(name="updated_at", type="datetime", nullable=true)
*/
protected $updatedAt;
/**
*
* @var Unit
*
* @ORM\ManyToOne(targetEntity="Unit")
* @ORM\JoinColumn(name="mapped_unit_id", referencedColumnName="id", nullable=true)
*/
protected $mappedUnit;
/**
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @param int $id
*/
public function setId($id)
{
$this->id = $id;
}
/**
* @return string
*/
public function getLabel()
{
return $this->label;
}
/**
* @param string $label
*/
public function setLabel($label)
{
$this->label = $label;
}
/**
* @return DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* @return ProductSalesUnit
* @ORM\PrePersist()
*/
public function setCreatedAt()
{
$this->createdAt = new DateTime();
$this->updatedAt = new DateTime();
return $this;
}
/**
* @return DateTime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
/**
* Set updatedAt
*
* @return ProductSalesUnit
* @ORM\PreUpdate
*/
public function setUpdatedAt()
{
$this->updatedAt = new DateTime();
return $this;
}
/**
* @return Unit
*/
public function getMappedUnit()
{
return $this->mappedUnit;
}
/**
* @param Unit $mappedUnit
*/
public function setMappedUnit($mappedUnit)
{
$this->mappedUnit = $mappedUnit;
}
}