text changes to registration mail content
[namibia] / module / Valuation / src / Valuation / Entity / XmlRpcCallbackLog.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_callback_log")
14  */
15 class XmlRpcCallbackLog
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=false, 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=250, nullable=false, name="callback_url");
54          */
55         protected $callbackUrl;
56
57         /**
58          * @ORM\Column(type="string", length=50, nullable=false, name="method_name");
59          */
60         protected $methodName;
61
62         /**
63          * @ORM\Column(type="text", nullable=true, name="packet");
64          */
65         protected $packet;
66
67         /**
68          * @ORM\Column(type="text", nullable=true, name="response");
69          */
70         protected $response;
71
72         /**
73          * @ORM\Column(type="string", length=50, nullable=false, name="status");
74          */
75         protected $status;
76
77         /**
78          * @ORM\Column(type="integer", nullable=false, name="attempts");
79          */
80         protected $attempts = 1;
81
82         /**
83          * @ORM\Column(type="datetime");
84          */
85         protected $created;
86
87
88
89         /**
90          * Magic getter to expose protected properties.
91          *
92          * @param string $property
93          * @return mixed
94          */
95         public function __get($property)
96         {
97                 return $this->$property;
98         }
99
100         /**
101          * Magic setter to save protected properties.
102          *
103          * @param string $property
104          * @param mixed $value
105          */
106         public function __set($property, $value)
107         {
108                 $this->$property = $value;
109         }
110
111         /**
112          * @ORM\PrePersist
113          */
114         public function setCreateTime()
115         {
116                 $this->created = new \DateTime("now");
117         }
118
119         /**
120          * Convert the object to an array.
121          * @param array $expand
122          * @param array $intersect
123          * @param boolean $showIdentifiers
124          * @param integer $expandAll
125          * @return array
126          */
127         public function toArray(
128                         array $expand = array(), array $intersect = array(),
129                         $showIdentifiers = false, $expandAll = 0
130                         )
131         {
132                 $intersect = array_flip($intersect);
133                 $dateTimeFormat = \Utility\Registry::getConfigParam('DateTimeFormat');
134                 $includeAll = empty($intersect);
135                 $data = array();
136                 ($includeAll || isset($intersect['id']))
137                         && $data['id'] = $this->id;
138                 ($includeAll || isset($intersect['xmlRpcClient']))
139                         && $data['xmlRpcClient'] = (in_array('xmlRpcClient', $expand) || $expandAll || $showIdentifiers)
140                                                                         && !is_null($this->xmlRpcClient)
141                                 ? (!$showIdentifiers || in_array('xmlRpcClient', $expand) ? $this->xmlRpcClient->toArray(
142                                                 $expand, $intersect, $showIdentifiers, ($expandAll - 1)
143                                                 ) : $this->xmlRpcClient->id)
144                                 : null;
145                 ($includeAll || isset($intersect['valuation']))
146                         && $data['valuation'] = (in_array('valuation', $expand) || $expandAll || $showIdentifiers)
147                                                                         && !is_null($this->valuation)
148                                 ? (!$showIdentifiers || in_array('valuation', $expand) ? $this->valuation->toArray(
149                                                 $expand, $intersect, $showIdentifiers, ($expandAll - 1)
150                                                 ) : $this->valuation->id)
151                                 : null;
152                 ($includeAll || isset($intersect['callbackUrl']))
153                         && $data['callbackUrl'] = $this->callbackUrl;
154                 ($includeAll || isset($intersect['methodName']))
155                         && $data['methodName'] = $this->methodName;
156                 ($includeAll || isset($intersect['packet']))
157                         && $data['packet'] = $this->packet;
158                 ($includeAll || isset($intersect['response']))
159                         && $data['response'] = $this->response;
160                 ($includeAll || isset($intersect['status']))
161                         && $data['status'] = $this->status;
162                 ($includeAll || isset($intersect['created']))
163                         && $data['created'] = !is_null($this->created)
164                                 ? $this->created->format($dateTimeFormat)
165                                 : null;
166                 return $data;
167         }
168
169         /**
170          * Populate from an array.
171          * @param array $data
172          */
173         public function fromArray($data = array())
174         {
175                 isset($data['id'])
176                         && $this->id = $data['id'];
177                 isset($data['xmlRpcClient'])
178                         && $this->xmlRpcClient = $data['xmlRpcClient'];
179                 isset($data['valuation'])
180                         && $this->valuation = $data['valuation'];
181                 isset($data['callbackUrl'])
182                         && $this->callbackUrl = $data['callbackUrl'];
183                 isset($data['methodName'])
184                         && $this->methodName = $data['methodName'];
185                 isset($data['packet'])
186                         && $this->packet = is_array($data['packet'])
187                                 ? serialize($data['packet'])
188                                 : $data['packet'];
189                 isset($data['response'])
190                         && $this->response = is_array($data['response'])
191                                 ? serialize($data['response'])
192                                 : $data['response'];
193                 isset($data['status'])
194                         && $this->status = $data['status'];
195         }
196
197
198
199 }
200