initial commit
[namibia] / module / Config / src / Config / Entity / Config.php
1 <?php
2 namespace Config\Entity;
3
4 use Doctrine\ORM\Mapping as ORM;
5
6
7
8 /**
9  * Dynamic application configuration data.
10  * @ORM\Entity
11  * @ORM\Table(name="app_config")
12  */
13 class Config
14 {
15
16         /**
17          * Can archive records.
18          */
19         const ARCHIVE = false;
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=25, nullable=true, name="date_format")
39          */
40         protected $dateFormat;
41
42         /**
43          * @ORM\Column(type="string", length=25, nullable=true, name="datetime_format")
44          */
45         protected $dateTimeFormat;
46
47         /**
48          * @ORM\Column(type="string", length=25, nullable=true, name="time_format")
49          */
50         protected $timeFormat;
51
52         /**
53          * @ORM\Column(type="string", length=50, nullable=true, name="excel_currency_format")
54          */
55         protected $excelCurrencyFormat;
56
57         /**
58          * @ORM\Column(type="string", length=5, nullable=true, name="currency_prefix")
59          */
60         protected $currencyPrefix;
61
62         /**
63          * @ORM\Column(type="decimal", scale=2, precision=5, nullable=false, name="vat_percentage", options={"unsigned"=true});
64          */
65         protected $vatPercentage = 0.0;
66
67         /**
68          * @ORM\Column(type="string", length=250, nullable=true, name="source_email_address")
69          */
70         protected $sourceEmailAddress;
71
72         /**
73          * @ORM\Column(type="string", length=20, nullable=true, name="source_mobile_address")
74          */
75         protected $sourceMobileAddress;
76
77         /**
78          * @ORM\Column(type="string", length=250, nullable=true, name="admin_email_address")
79          */
80         protected $adminEmailAddress;
81
82         /**
83          * @ORM\Column(type="boolean", name="sms_new_pin");
84          */
85         protected $smsNewPin = false;
86
87         /**
88          * @ORM\Column(type="boolean", name="sms_customer_valuation");
89          */
90         protected $smsCustomerValuation = false;
91
92         /**
93          * @ORM\Column(type="smallint", nullable=true, name="price_guide_open_days")
94          */
95         protected $priceGuideOpenDays;
96
97         /**
98          * @ORM\Column(type="smallint", nullable=true, name="price_guide_completion_days")
99          */
100         protected $priceGuideCompletionDays;
101
102         /**
103          * @ORM\Column(type="smallint", nullable=true, name="auction_max_days")
104          */
105         protected $auctionMaxDays;
106
107         /**
108          * @ORM\ManyToOne(targetEntity="\User\Entity\Permissions")
109          * @ORM\JoinColumn(nullable=false, name="profile_permissions_id")
110          **/
111         protected $defaultPermissions;
112
113         /**
114          * @ORM\Column(type="decimal", scale=2, precision=5, nullable=false, name="app_version", options={"unsigned"=true});
115          */
116         protected $appVersion = 1.0;
117
118
119
120         /**
121          * Magic getter to expose protected properties.
122          * @param string $property
123          * @return mixed
124          */
125         public function __get($property)
126         {
127                 if ('jobState' == $property)
128                 {
129                         return 'Active';
130                 }
131                 return $this->$property;
132         }
133
134         /**
135          * Magic setter to save protected properties.
136          * @param string $property
137          * @param mixed $value
138          */
139         public function __set($property, $value)
140         {
141                 $this->$property = $value;
142         }
143
144         /**
145          * Convert the object to an array.
146          * @param array $expand
147          * @param array $intersect
148          * @return array
149          */
150         public function toArray()
151         {
152                 return array(
153                                 'dateFormat'               => $this->dateFormat,
154                                 'dateTimeFormat'           => $this->dateTimeFormat,
155                                 'timeFormat'               => $this->timeFormat,
156                                 'excelCurrencyFormat'      => $this->excelCurrencyFormat,
157                                 'currencyPrefix'           => $this->currencyPrefix,
158                                 'vatPercentage'            => $this->vatPercentage,
159                                 'sourceEmailAddress'       => $this->sourceEmailAddress,
160                                 'sourceMobileAddress'      => $this->sourceMobileAddress,
161                                 'adminEmailAddress'        => $this->adminEmailAddress,
162                                 'smsNewPin'                => $this->smsNewPin,
163                                 'smsCustomerValuation'     => $this->smsCustomerValuation,
164                                 'priceGuideOpenDays'       => $this->priceGuideOpenDays,
165                                 'priceGuideCompletionDays' => $this->priceGuideCompletionDays,
166                                 'auctionMaxDays'           => $this->auctionMaxDays,
167                                 'appVersion'               => $this->appVersion,
168                                 'defaultPermissions'       => !is_null($this->defaultPermissions)
169                                         ? $this->defaultPermissions->toArray()
170                                         : array()
171                 );
172         }
173
174         /**
175          * Populate from an array.
176          * @param array $data
177          */
178         public function fromArray($data = array())
179         {
180                 isset($data['id'])
181                         && $this->id = $data['id'];
182                 isset($data['dateFormat'])
183                         && $this->dateFormat  = $data['dateFormat'];
184                 isset($data['dateTimeFormat'])
185                         && $this->dateTimeFormat  = $data['dateTimeFormat'];
186                 isset($data['timeFormat'])
187                         && $this->timeFormat  = $data['timeFormat'];
188                 isset($data['excelCurrencyFormat'])
189                         && $this->excelCurrencyFormat  = $data['excelCurrencyFormat'];
190                 isset($data['currencyPrefix'])
191                         && $this->currencyPrefix  = $data['currencyPrefix'];
192                 isset($data['vatPercentage'])
193                         && $this->vatPercentage  = $data['vatPercentage'];
194                 isset($data['sourceEmailAddress'])
195                         && $this->sourceEmailAddress  = $data['sourceEmailAddress'];
196                 isset($data['sourceMobileAddress'])
197                         && $this->sourceMobileAddress  = $data['sourceMobileAddress'];
198                 isset($data['adminEmailAddress'])
199                         && $this->adminEmailAddress  = $data['adminEmailAddress'];
200                 isset($data['smsNewPin'])
201                         && $this->smsNewPin  = $data['smsNewPin'];
202                 isset($data['smsCustomerValuation'])
203                         && $this->smsCustomerValuation  = $data['smsCustomerValuation'];
204                 isset($data['priceGuideOpenDays'])
205                         && $this->priceGuideOpenDays  = $data['priceGuideOpenDays'];
206                 isset($data['priceGuideCompletionDays'])
207                         && $this->priceGuideCompletionDays  = $data['priceGuideCompletionDays'];
208                 isset($data['auctionMaxDays'])
209                         && $this->auctionMaxDays  = $data['auctionMaxDays'];
210                 isset($data['appVersion'])
211                         && $this->appVersion  = $data['appVersion'];
212                 isset($data['defaultPermissions'])
213                         && $this->defaultPermissions  = $data['defaultPermissions'];
214         }
215
216 }