initial commit
[namibia] / module / Stock / src / Stock / Entity / ExteriorColour.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="vehicle_exterior_colour", uniqueConstraints={@ORM\UniqueConstraint(name="unique_exterior_colour", columns={"name"})})
11  */
12 class ExteriorColour
13 {
14
15         /**
16          * Can archive records.
17          */
18         const ARCHIVE = true;
19         /**
20          * Pull Synchronization Strategy for this table.
21          */
22         const PULL_SYNCH_STRATEGY = 'Build';
23         /**
24          * Push Synchronization Strategy for this table.
25          */
26         const PUSH_SYNCH_STRATEGY = 'Build';
27
28
29         /**
30          * @ORM\Id
31          * @ORM\Column(type="integer");
32          * @ORM\GeneratedValue(strategy="AUTO")
33          */
34         protected $id;
35
36         /**
37          * @ORM\Column(type="string", length=75, unique=true)
38          */
39         protected $name;
40
41         /**
42          * @ORM\Column(type="boolean");
43          */
44         protected $archived = false;
45
46
47
48         /**
49          * Magic getter to expose protected properties.
50          * @param string $property
51          * @return mixed
52          */
53         public function __get($property)
54         {
55                 return $this->$property;
56         }
57
58         /**
59          * Magic setter to save protected properties.
60          * @param string $property
61          * @param mixed $value
62          */
63         public function __set($property, $value)
64         {
65                 $this->$property = $value;
66         }
67
68         /**
69          * Convert the object to an array.
70          * @param array $expand
71          * @param array $intersect
72          * @return array
73          */
74         public function toArray(array $expand = array(), array $intersect = array())
75         {
76                 $includeAll = empty($intersect);
77                 $data = array();
78                 ($includeAll || isset($intersect['id']))
79                         && $data['id'] = $this->id;
80                 ($includeAll || isset($intersect['name']))
81                         && $data['name'] = $this->name;
82                 return $data;
83         }
84
85         /**
86          * Convert the object to an array for synchronization.
87          * @return array
88          */
89         public function toSynchArray()
90         {
91                 return array(
92                                 'id'   => $this->id,
93                                 'name' => $this->name
94                 );
95         }
96
97         /**
98          * Populate from an array.
99          * @param array $data
100          */
101         public function fromArray($data = array())
102         {
103                 isset($data['id'])
104                         && $this->id = $data['id'];
105                 isset($data['name'])
106                         && $this->name  = $data['name'];
107         }
108
109 }