click to refresh error debugging
[namibia] / module / Stock / src / Stock / Entity / StockAccessory.php
1 <?php
2 namespace Stock\Entity;
3
4 use Doctrine\ORM\Mapping as ORM;
5
6
7
8 /**
9  * @ORM\Entity
10  * @ORM\Table(name="stock_accessories")
11  */
12 class StockAccessory
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="Stock", inversedBy="accessories")
38          * @ORM\JoinColumn(name="stock_id", referencedColumnName="id")
39          **/
40         protected $stock;
41
42         /**
43          * @ORM\ManyToOne(targetEntity="Accessory")
44          * @ORM\JoinColumn(name="vehicle_accessory_id", referencedColumnName="id")
45          **/
46         protected $accessory;
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['accessory']))
85                         && $data['accessory'] = $showIdentifiers
86                                                                         ? $this->accessory->id
87                                                                         : $this->accessory->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['accessory'])
102                         && $this->accessory  = $data['accessory'];
103         }
104
105 }