text changes to registration mail content
[namibia] / module / Valuation / src / Valuation / Entity / XmlRpcRequestLog.php
1 <?php
2 namespace Valuation\Entity;
3
4 use Doctrine\ORM\Mapping as ORM;
5
6
7
8 /**
9  * An xml-rpc request log entry.
10  *
11  * @ORM\Entity
12  * @ORM\HasLifecycleCallbacks
13  * @ORM\Table(name="xmlrpc_request_log")
14  */
15 class XmlRpcRequestLog
16 {
17
18         /**
19          * Cannot archive records.
20          */
21         const ARCHIVE = false;
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\ManyToOne(targetEntity="\Valuation\Entity\XmlRpc", cascade={"all"})
42          * @ORM\JoinColumn(nullable=true, name="xmlrpc_auth_id")
43          **/
44         protected $xmlRpcClient;
45
46         /**
47          * @ORM\ManyToOne(targetEntity="Valuation")
48          * @ORM\JoinColumn(nullable=true, name="stock_valuation_id", referencedColumnName="id")
49          **/
50         protected $valuation;
51
52         /**
53          * @ORM\Column(type="string", length=42, nullable=true, name="client_api_id");
54          */
55         protected $clientApiId;
56
57         /**
58          * @ORM\Column(type="string", length=40, nullable=true, name="ip_address");
59          */
60         protected $ipAddress;
61
62         /**
63          * @ORM\Column(type="string", length=50, nullable=false, name="method_name");
64          */
65         protected $methodName;
66
67         /**
68          * @ORM\Column(type="text", nullable=true, name="packet");
69          */
70         protected $packet;
71
72         /**
73          * @ORM\Column(type="string", length=250, nullable=false, name="status");
74          */
75         protected $status;
76
77         /**
78          * @ORM\Column(type="datetime");
79          */
80         protected $created;
81
82
83
84         /**
85          * Magic getter to expose protected properties.
86          *
87          * @param string $property
88          * @return mixed
89          */
90         public function __get($property)
91         {
92                 return $this->$property;
93         }
94
95         /**
96          * Magic setter to save protected properties.
97          *
98          * @param string $property
99          * @param mixed $value
100          */
101         public function __set($property, $value)
102         {
103                 $this->$property = $value;
104         }
105
106         /**
107          * @ORM\PrePersist
108          */
109         public function setCreateTime()
110         {
111                 $this->created = new \DateTime("now");
112         }
113
114         /**
115          * Convert the object to an array.
116          * @param array $expand
117          * @param array $intersect
118          * @param boolean $showIdentifiers
119          * @param integer $expandAll
120          * @return array
121          */
122         public function toArray(
123                         array $expand = array(), array $intersect = array(),
124                         $showIdentifiers = false, $expandAll = 0
125                         )
126         {
127                 $intersect = array_flip($intersect);
128                 $dateTimeFormat = \Utility\Registry::getConfigParam('DateTimeFormat');
129                 $includeAll = empty($intersect);
130                 $data = array();
131                 ($includeAll || isset($intersect['id']))
132                         && $data['id'] = $this->id;
133                 ($includeAll || isset($intersect['xmlRpcClient']))
134                         && $data['xmlRpcClient'] = (in_array('xmlRpcClient', $expand) || $expandAll || $showIdentifiers)
135                                                                         && !is_null($this->xmlRpcClient)
136                                 ? (!$showIdentifiers || in_array('xmlRpcClient', $expand) ? $this->xmlRpcClient->toArray(
137                                                 $expand, $intersect, $showIdentifiers, ($expandAll - 1)
138                                                 ) : $this->xmlRpcClient->id)
139                                 : null;
140                 ($includeAll || isset($intersect['valuation']))
141                         && $data['valuation'] = (in_array('valuation', $expand) || $expandAll || $showIdentifiers)
142                                                                         && !is_null($this->valuation)
143                                 ? (!$showIdentifiers || in_array('valuation', $expand) ? $this->valuation->toArray(
144                                                 $expand, $intersect, $showIdentifiers, ($expandAll - 1)
145                                                 ) : $this->valuation->id)
146                                 : null;
147                 ($includeAll || isset($intersect['clientApiId']))
148                         && $data['clientApiId'] = $this->clientApiId;
149                 ($includeAll || isset($intersect['ipAddress']))
150                         && $data['ipAddress'] = $this->ipAddress;
151                 ($includeAll || isset($intersect['methodName']))
152                         && $data['methodName'] = $this->methodName;
153                 ($includeAll || isset($intersect['packet']))
154                         && $data['packet'] = $this->packet;
155                 ($includeAll || isset($intersect['status']))
156                         && $data['status'] = $this->status;
157                 ($includeAll || isset($intersect['created']))
158                         && $data['created'] = !is_null($this->created)
159                                 ? $this->created->format($dateTimeFormat)
160                                 : null;
161                 return $data;
162         }
163
164         /**
165          * Populate from an array.
166          * @param array $data
167          */
168         public function fromArray($data = array())
169         {
170                 isset($data['id'])
171                         && $this->id = $data['id'];
172                 isset($data['xmlRpcClient'])
173                         && $this->xmlRpcClient = $data['xmlRpcClient'];
174                 isset($data['clientApiId'])
175                         && $this->clientApiId = $data['clientApiId'];
176                 isset($data['ipAddress'])
177                         && $this->ipAddress = $data['ipAddress'];
178                 isset($data['valuation'])
179                         && $this->valuation = $data['valuation'];
180                 isset($data['methodName'])
181                         && $this->methodName = $data['methodName'];
182                 isset($data['packet'])
183                         && $this->packet = is_array($data['packet'])
184                                 ? serialize($data['packet'])
185                                 : $data['packet'];
186                 isset($data['status'])
187                         && $this->status = $data['status'];
188         }
189
190
191
192 }
193