text changes to registration mail content
[namibia] / module / PriceGuide / src / PriceGuide / Entity / AllowedMember.php
1 <?php
2 namespace PriceGuide\Entity;
3
4 use Doctrine\ORM\Mapping as ORM;
5
6
7
8 /**
9  * A price guide club member.
10  *
11  * @ORM\Entity
12  * @ORM\HasLifecycleCallbacks
13  * @ORM\Table(name="price_guide_allowed_member")
14  */
15 class AllowedMember
16 {
17
18         /**
19          * Can archive records.
20          */
21         const ARCHIVE = true;
22         /**
23          * Pull Synchronization Strategy for this table.
24          */
25         const PULL_SYNCH_STRATEGY = false;
26         /**
27          * Push Synchronization Strategy for this table.
28          */
29         const PUSH_SYNCH_STRATEGY = false;
30
31
32
33         /**
34          * @ORM\Id
35          * @ORM\Column(type="integer");
36          * @ORM\GeneratedValue(strategy="AUTO")
37          */
38         protected $id;
39
40         /**
41          * @ORM\Column(type="string", length=250);
42          */
43         protected $name;
44
45         /**
46          * @ORM\Column(type="string", length=250);
47          */
48         protected $email;
49
50         /**
51          * @ORM\Column(type="datetime");
52          */
53         protected $created;
54
55         /**
56          * @ORM\Column(type="datetime", nullable=true);
57          */
58         protected $updated;
59
60         /**
61          * @ORM\Column(type="boolean");
62          */
63         protected $archived = false;
64
65
66
67         /**
68          * Magic getter to expose protected properties.
69          *
70          * @param string $property
71          * @return mixed
72          */
73         public function __get($property)
74         {
75                 return $this->$property;
76         }
77
78         /**
79          * Magic setter to save protected properties.
80          *
81          * @param string $property
82          * @param mixed $value
83          */
84         public function __set($property, $value)
85         {
86                 $this->$property = $value;
87         }
88
89         /**
90          * @ORM\PrePersist
91          */
92         public function setCreateTime()
93         {
94                 $this->created = new \DateTime("now");
95         }
96
97         /**
98          * @ORM\PreUpdate
99          */
100         public function setUpdateTime()
101         {
102                 $this->updated = new \DateTime("now");
103         }
104
105         /**
106          * Convert the object to an array.
107          * @param array $expand
108          * @param array $intersect
109          * @param boolean $showIdentifiers
110          * @param integer $expandAll
111          * @return array
112          */
113         public function toArray(
114                         array $expand = array(), array $intersect = array(),
115                         $showIdentifiers = false, $expandAll = 0
116                         )
117         {
118                 $intersect = array_flip($intersect);
119                 $dateTimeFormat = \Utility\Registry::getConfigParam('DateTimeFormat');
120                 $includeAll = empty($intersect);
121                 $data = array();
122                 ($includeAll || isset($intersect['id']))
123                         && $data['id'] = $this->id;
124                 ($includeAll || isset($intersect['name']))
125                         && $data['name'] = $this->name;
126                 ($includeAll || isset($intersect['email']))
127                         && $data['email'] = $this->email;
128                 ($includeAll || isset($intersect['created']))
129                         && $data['created'] = !is_null($this->created)
130                                 ? $this->created->format($dateTimeFormat)
131                                 : null;
132                 ($includeAll || isset($intersect['updated']))
133                         && $data['updated'] = !is_null($this->updated)
134                                 ? $this->updated->format($dateTimeFormat)
135                                 : null;
136                 return $data;
137         }
138
139         /**
140          * Populate from an array.
141          * @param array $data
142          */
143         public function fromArray($data = array())
144         {
145                 isset($data['id'])
146                         && $this->id = $data['id'];
147                 isset($data['name'])
148                         && $this->name = $data['name'];
149                 isset($data['email'])
150                         && $this->email = $data['email'];
151         }
152
153
154
155 }
156