2 namespace Valuation\Entity;
4 use Doctrine\ORM\Mapping as ORM;
9 * An xml-rpc request log entry.
12 * @ORM\HasLifecycleCallbacks
13 * @ORM\Table(name="xmlrpc_request_log")
15 class XmlRpcRequestLog
19 * Cannot archive records.
21 const ARCHIVE = false;
23 * Pull Synchronization Strategy for this table.
25 const PULL_SYNCH_STRATEGY = false;
27 * Push Synchronization Strategy for this table.
29 const PUSH_SYNCH_STRATEGY = false;
35 * @ORM\Column(type="integer");
36 * @ORM\GeneratedValue(strategy="AUTO")
41 * @ORM\ManyToOne(targetEntity="\Valuation\Entity\XmlRpc", cascade={"all"})
42 * @ORM\JoinColumn(nullable=true, name="xmlrpc_auth_id")
44 protected $xmlRpcClient;
47 * @ORM\ManyToOne(targetEntity="Valuation")
48 * @ORM\JoinColumn(nullable=true, name="stock_valuation_id", referencedColumnName="id")
53 * @ORM\Column(type="string", length=42, nullable=true, name="client_api_id");
55 protected $clientApiId;
58 * @ORM\Column(type="string", length=40, nullable=true, name="ip_address");
63 * @ORM\Column(type="string", length=50, nullable=false, name="method_name");
65 protected $methodName;
68 * @ORM\Column(type="text", nullable=true, name="packet");
73 * @ORM\Column(type="string", length=250, nullable=false, name="status");
78 * @ORM\Column(type="datetime");
85 * Magic getter to expose protected properties.
87 * @param string $property
90 public function __get($property)
92 return $this->$property;
96 * Magic setter to save protected properties.
98 * @param string $property
101 public function __set($property, $value)
103 $this->$property = $value;
109 public function setCreateTime()
111 $this->created = new \DateTime("now");
115 * Convert the object to an array.
116 * @param array $expand
117 * @param array $intersect
118 * @param boolean $showIdentifiers
119 * @param integer $expandAll
122 public function toArray(
123 array $expand = array(), array $intersect = array(),
124 $showIdentifiers = false, $expandAll = 0
127 $intersect = array_flip($intersect);
128 $dateTimeFormat = \Utility\Registry::getConfigParam('DateTimeFormat');
129 $includeAll = empty($intersect);
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)
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)
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)
165 * Populate from an array.
168 public function fromArray($data = array())
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'])
186 isset($data['status'])
187 && $this->status = $data['status'];