partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

ProjectRunPart.php (2444B)


      1 <?php
      2 
      3 namespace PartKeepr\ProjectBundle\Entity;
      4 
      5 use Doctrine\ORM\Mapping as ORM;
      6 use PartKeepr\CoreBundle\Entity\BaseEntity;
      7 use PartKeepr\PartBundle\Entity\Part;
      8 use Symfony\Component\Serializer\Annotation\Groups;
      9 
     10 /**
     11  * Represents a project run part.
     12  *
     13  * @ORM\Entity
     14  */
     15 class ProjectRunPart extends BaseEntity
     16 {
     17     /**
     18      * Stores the project run.
     19      *
     20      * @ORM\ManyToOne(targetEntity="PartKeepr\ProjectBundle\Entity\ProjectRun")
     21      * @Groups({"default"})
     22      *
     23      * @var ProjectRun
     24      */
     25     private $projectRun;
     26 
     27     /**
     28      * Stores the part used in a production run.
     29      *
     30      * @ORM\ManyToOne(targetEntity="PartKeepr\PartBundle\Entity\Part")
     31      * @Groups({"default"})
     32      *
     33      * @var Part
     34      */
     35     private $part;
     36 
     37     /**
     38      * Stores the quantity of a production run.
     39      *
     40      * @ORM\Column(type="integer")
     41      * @Groups({"default"})
     42      *
     43      * @var int
     44      */
     45     private $quantity;
     46 
     47     /**
     48      * Specifies the lot number.
     49      *
     50      * @ORM\Column(type="text")
     51      * @Groups({"default"})
     52      *
     53      * @var string
     54      */
     55     private $lotNumber;
     56 
     57     /**
     58      * @return string
     59      */
     60     public function getLotNumber()
     61     {
     62         return $this->lotNumber;
     63     }
     64 
     65     /**
     66      * @param string $lotNumber
     67      */
     68     public function setLotNumber($lotNumber)
     69     {
     70         $this->lotNumber = $lotNumber;
     71     }
     72 
     73     /**
     74      * @return ProjectRun
     75      */
     76     public function getProjectRun()
     77     {
     78         return $this->projectRun;
     79     }
     80 
     81     /**
     82      * @param ProjectRun $projectRun
     83      */
     84     public function setProjectRun($projectRun)
     85     {
     86         $this->projectRun = $projectRun;
     87     }
     88 
     89     /**
     90      * @return Part
     91      */
     92     public function getPart()
     93     {
     94         return $this->part;
     95     }
     96 
     97     /**
     98      * @param Part $part
     99      */
    100     public function setPart($part)
    101     {
    102         $this->part = $part;
    103     }
    104 
    105     /**
    106      * @return int
    107      */
    108     public function getQuantity()
    109     {
    110         return $this->quantity;
    111     }
    112 
    113     /**
    114      * @param int $quantity
    115      */
    116     public function setQuantity($quantity)
    117     {
    118         $this->quantity = $quantity;
    119     }
    120 
    121     public function __toString()
    122     {
    123         // @todo i18n
    124         return sprintf(
    125             "Used in project run for project %s on %s",
    126             $this->getProjectRun()->getProject()->getName(),
    127             $this->getProjectRun()->getRunDateTime()->format("Y-m-d H:i:s")
    128         )." / ".parent::__toString();
    129     }
    130 }