partkeepr

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

StatisticSnapshot.php (2810B)


      1 <?php
      2 
      3 namespace PartKeepr\StatisticBundle\Entity;
      4 
      5 use Doctrine\Common\Collections\ArrayCollection;
      6 use Doctrine\ORM\Mapping as Mapping;
      7 
      8 /**
      9  * @Mapping\Entity()
     10  */
     11 class StatisticSnapshot
     12 {
     13     /**
     14      * @Mapping\Id
     15      * @Mapping\Column(type="integer")
     16      * @Mapping\GeneratedValue(strategy="AUTO")
     17      *
     18      * @var int
     19      */
     20     private $id;
     21 
     22     /**
     23      * Defines the date when this snapshot has been taken.
     24      *
     25      * @Mapping\Column(type="datetime")
     26      *
     27      * @var \DateTime
     28      */
     29     private $dateTime;
     30 
     31     /**
     32      * Defines the amount of different parts in the database.
     33      *
     34      * @Mapping\Column(type="integer")
     35      *
     36      * @var int
     37      */
     38     private $parts;
     39 
     40     /**
     41      * Defines the amount of categories.
     42      *
     43      * @Mapping\Column(type="integer")
     44      *
     45      * @var int
     46      */
     47     private $categories;
     48 
     49     /**
     50      * Holds all defined units in the database.
     51      *
     52      * @Mapping\OneToMany(targetEntity="PartKeepr\StatisticBundle\Entity\StatisticSnapshotUnit",mappedBy="statisticSnapshot",cascade={"persist", "remove"})
     53      */
     54     private $units;
     55 
     56     /**
     57      * Creates a new statistic snapshot.
     58      */
     59     public function __construct()
     60     {
     61         $this->units = new ArrayCollection();
     62         $this->setDateTime(new \DateTime());
     63     }
     64 
     65     /**
     66      * Sets the date+time for the snapshot.
     67      *
     68      * @param \DateTime $dateTime The date+time for the snapshot
     69      */
     70     public function setDateTime(\DateTime $dateTime)
     71     {
     72         $this->dateTime = $dateTime;
     73     }
     74 
     75     /**
     76      * Returns the date+time for the snapshot.
     77      *
     78      * @return \DateTime The date+time for the snapshot
     79      */
     80     public function getDateTime()
     81     {
     82         return $this->dateTime;
     83     }
     84 
     85     /**
     86      * Sets the amount of overall parts for the snapshot.
     87      *
     88      * @param int $parts The amount of parts
     89      */
     90     public function setParts($parts)
     91     {
     92         $this->parts = $parts;
     93     }
     94 
     95     /**
     96      * Returns the amount of overall parts for the snapshot.
     97      *
     98      * @return int The amount of parts
     99      */
    100     public function getParts()
    101     {
    102         return $this->parts;
    103     }
    104 
    105     /**
    106      * Sets the amount of categories for the snapshot.
    107      *
    108      * @param int $categories The amount of categories
    109      */
    110     public function setCategories($categories)
    111     {
    112         $this->categories = $categories;
    113     }
    114 
    115     /**
    116      * Returns the amount of categories.
    117      *
    118      * @return int The amount of categories
    119      */
    120     public function getCategories()
    121     {
    122         return $this->categories;
    123     }
    124 
    125     /**
    126      * Returns the ID of this snapshot.
    127      *
    128      * @return int The ID of this snapshot
    129      */
    130     public function getId()
    131     {
    132         return $this->id;
    133     }
    134 
    135     public function getUnits()
    136     {
    137         return $this->units;
    138     }
    139 }