2 namespace Utility\Entity;
4 use Doctrine\ORM\Mapping as ORM;
11 * @ORM\HasLifecycleCallbacks
12 * @ORM\Table(name="lib_api_log")
18 * Can archive records.
22 * Pull Synchronization Strategy for this table.
24 const PULL_SYNCH_STRATEGY = false;
26 * Push Synchronization Strategy for this table.
28 const PUSH_SYNCH_STRATEGY = false;
32 * @ORM\Column(type="integer");
33 * @ORM\GeneratedValue(strategy="AUTO")
38 * @ORM\Column(type="string", nullable=true, length=250)
43 * @ORM\Column(type="array", nullable=true)
48 * @ORM\Column(type="array", nullable=true)
53 * @ORM\Column(type="string", length=30, name="status")
58 * @ORM\ManyToOne(targetEntity="\Company\Entity\Company")
59 * @ORM\JoinColumn(nullable=true, name="from_company_id")
61 protected $fromCompany;
64 * @ORM\ManyToOne(targetEntity="\User\Entity\Profile")
65 * @ORM\JoinColumn(nullable=true, name="from_profile_id")
67 protected $fromProfile;
70 * @ORM\Column(type="datetime");
75 * @ORM\Column(type="datetime", nullable=true);
80 * @ORM\Column(type="boolean");
82 protected $archived = false;
86 * 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.
97 * @param string $property
100 public function __set($property, $value)
102 $this->$property = $value;
108 public function setCreateTime()
110 $this->created = new \DateTime("now");
116 public function setUpdateTime()
118 $this->updated = new \DateTime("now");
122 * Convert the object to an array.
123 * @param array $expand
124 * @param array $intersect
127 public function toArray(array $expand = array('attachment'), array $intersect = array())
129 $dateTimeFormat = \Utility\Registry::getConfigParam('DateTimeFormat');
130 $includeAll = empty($intersect);
132 ($includeAll || isset($intersect['id']))
133 && $data['id'] = $this->id;
134 ($includeAll || isset($intersect['service']))
135 && $data['service'] = $this->service;
136 ($includeAll || isset($intersect['request']))
137 && $data['request'] = $this->request;
138 ($includeAll || isset($intersect['response']))
139 && $data['response'] = $this->response;
140 ($includeAll || isset($intersect['status']))
141 && $data['status'] = $this->status;
142 ($includeAll || isset($intersect['fromCompany']))
143 && $data['fromCompany'] = in_array('fromCompany', $expand)
144 && !is_null($this->fromCompany)
145 ? $this->fromCompany->toArray($expand, $intersect)
147 ($includeAll || isset($intersect['fromProfile']))
148 && $data['fromProfile'] = in_array('fromProfile', $expand)
149 && !is_null($this->fromProfile)
150 ? $this->fromProfile->toArray($expand, $intersect)
152 ($includeAll || isset($intersect['created']))
153 && $data['created'] = !is_null($this->created)
154 ? $this->created->format($dateTimeFormat)
156 ($includeAll || isset($intersect['updated']))
157 && $data['updated'] = !is_null($this->updated)
158 ? $this->updated->format($dateTimeFormat)
164 * Populate from an array.
167 public function fromArray($data = array())
170 && $this->id = $data['id'];
171 isset($data['service'])
172 && $this->service = $data['service'];
173 isset($data['request'])
174 && $this->request = $data['request'];
175 isset($data['response'])
176 && $this->response = $data['response'];
177 isset($data['status'])
178 && $this->status = $data['status'];
179 isset($data['fromCompany'])
180 && $this->fromCompany = $data['fromCompany'];
181 isset($data['fromProfile'])
182 && $this->fromProfile = $data['fromProfile'];