initial commit
[namibia] / module / Adherence / src / Adherence / Entity / AdherenceStock.php
1 <?php
2 namespace Adherence\Entity;
3
4 use Doctrine\ORM\Mapping as ORM;
5
6
7
8 /**
9  * @ORM\Entity
10  * @ORM\Table(name="adherence_stock")
11  */
12 class AdherenceStock
13 {
14
15         /**
16          * Can archive records.
17          */
18         const ARCHIVE = false;
19         /**
20          * Pull Synchronization Strategy for this table.
21          */
22         const PULL_SYNCH_STRATEGY = false;
23         /**
24          * Push Synchronization Strategy for this table.
25          */
26         const PUSH_SYNCH_STRATEGY = false;
27
28
29         /**
30          * @ORM\Id
31          * @ORM\Column(type="integer");
32          * @ORM\GeneratedValue(strategy="AUTO")
33          */
34         protected $id;
35
36         /**
37          * @ORM\ManyToOne(targetEntity="Adherence")
38          * @ORM\JoinColumn(name="adherence_id", referencedColumnName="id")
39          **/
40         protected $adherence;
41
42         /**
43          * @ORM\ManyToOne(targetEntity="\Stock\Entity\Stock", inversedBy="adherence")
44          * @ORM\JoinColumn(name="stock_id", referencedColumnName="id")
45          **/
46         protected $stock;
47
48
49
50         /**
51          * Magic getter to expose protected properties.
52          * @param string $property
53          * @return mixed
54          */
55         public function __get($property)
56         {
57                 return $this->$property;
58         }
59
60         /**
61          * Magic setter to save protected properties.
62          * @param string $property
63          * @param mixed $value
64          */
65         public function __set($property, $value)
66         {
67                 $this->$property = $value;
68         }
69
70         /**
71          * Convert the object to an array.
72          * @param array $expand
73          * @param array $intersect
74          * @return array
75          */
76         public function toArray(
77                         array $expand = array(), array $intersect = array(), $showIdentifiers = false
78                         )
79         {
80                 $includeAll = empty($intersect);
81                 $data = array();
82                 ($includeAll || isset($intersect['id']))
83                         && $data['id'] = $this->id;
84                 ($includeAll || isset($intersect['adherence']))
85                         && $data['adherence'] = $showIdentifiers
86                                                                         ? $this->adherence->id
87                                                                         : $this->adherence->toArray();
88                 return $data;
89         }
90
91         /**
92          * Populate from an array.
93          * @param array $data
94          */
95         public function fromArray($data = array())
96         {
97                 isset($data['id'])
98                         && $this->id = $data['id'];
99                 isset($data['stock'])
100                         && $this->stock  = $data['stock'];
101                 isset($data['adherence'])
102                         && $this->adherence  = $data['adherence'];
103         }
104
105 }