initial commit
[namibia] / module / Person / src / Person / Entity / Contact.php
1 <?php
2 namespace Person\Entity;
3
4 use Doctrine\ORM\Mapping as ORM;
5
6
7
8 /**
9  * A country, in such a small file, imagine that.
10  * @ORM\Entity
11  * @ORM\Table(name="lib_contact")
12  */
13 class Contact
14 {
15
16         /**
17          * Can archive records.
18          */
19         const ARCHIVE = true;
20         /**
21          * Pull Synchronization Strategy for this table.
22          */
23         const PULL_SYNCH_STRATEGY = false;
24         /**
25          * Push Synchronization Strategy for this table.
26          */
27         const PUSH_SYNCH_STRATEGY = false;
28
29
30         /**
31          * @ORM\Id
32          * @ORM\Column(type="integer");
33          * @ORM\GeneratedValue(strategy="AUTO")
34          */
35         protected $id;
36
37         /**
38          * @ORM\Column(type="string", length=50, nullable=true, name="first_name")
39          */
40         protected $firstName;
41
42         /**
43          * @ORM\Column(type="string", length=50, nullable=true, name="family_name")
44          */
45         protected $familyName;
46
47         /**
48          * @ORM\Column(type="string", length=20, nullable=true)
49          */
50         protected $mobile;
51
52         /**
53          * @ORM\Column(type="string", length=20, nullable=true)
54          */
55         protected $office;
56
57         /**
58          * @ORM\Column(type="string", length=20, nullable=true)
59          */
60         protected $fax;
61
62         /**
63          * @ORM\Column(type="string", length=255, nullable=true)
64          */
65         protected $email;
66
67         /**
68          * @ORM\Column(type="boolean");
69          */
70         protected $archived = false;
71
72
73         /**
74          * Magic getter to expose protected properties.
75          * @param string $property
76          * @return mixed
77          */
78         public function __get($property)
79         {
80                 return $this->$property;
81         }
82
83         /**
84          * Magic setter to save protected properties.
85          * @param string $property
86          * @param mixed $value
87          */
88         public function __set($property, $value)
89         {
90                 $this->$property = $value;
91         }
92
93         /**
94          * Convert the object to an array.
95          * @param array $expand
96          * @param array $intersect
97          * @return array
98          */
99         public function toArray(array $expand = array(), array $intersect = array())
100         {
101                 $includeAll = empty($intersect);
102                 $data = array();
103                 ($includeAll || isset($intersect['id']))
104                         && $data['id'] = $this->id;
105                 ($includeAll || isset($intersect['firstName']))
106                         && $data['firstName'] = $this->firstName;
107                 ($includeAll || isset($intersect['familyName']))
108                         && $data['familyName'] = $this->familyName;
109                 ($includeAll || isset($intersect['fullName']))
110                         && $data['fullName'] = $this->firstName . ' ' . $this->familyName;
111                 ($includeAll || isset($intersect['mobile']))
112                         && $data['mobile'] = $this->mobile;
113                 ($includeAll || isset($intersect['office']))
114                         && $data['office'] = $this->office;
115                 ($includeAll || isset($intersect['fax']))
116                         && $data['fax'] = $this->fax;
117                 ($includeAll || isset($intersect['email']))
118                         && $data['email'] = $this->email;
119                 return $data;
120         }
121
122         /**
123          * Populate from an array.
124          * @param array $data
125          */
126         public function fromArray($data = array())
127         {
128                 isset($data['id'])
129                         && $this->id = $data['id'];
130                 isset($data['firstName'])
131                         && $this->firstName = $data['firstName'];
132                 isset($data['familyName'])
133                         && $this->familyName = $data['familyName'];
134                 isset($data['mobile'])
135                         && $this->mobile = $data['mobile'];
136                 isset($data['office'])
137                         && $this->office = $data['office'];
138                 isset($data['fax'])
139                         && $this->fax = $data['fax'];
140                 isset($data['email'])
141                         && $this->email = $data['email'];
142         }
143
144 }