$property; } /** * Magic setter to save protected properties. * * @param string $property * @param mixed $value */ public function __set($property, $value) { $this->$property = $value; } /** * @ORM\PrePersist */ public function setCreateTime() { $this->created = new \DateTime("now"); $this->fromCompany = \Utility\Registry::resolveCompanyContext(); $this->createdBy = \Utility\Registry::resolveProfileContext($this->createdBy); } /** * @ORM\PreUpdate */ public function setUpdateTime() { $this->updated = new \DateTime("now"); } /** * Convert the object to an array. * @param array $expand * @param array $intersect * @param boolean $showIdentifiers * @param integer $expandAll * @return array */ public function toArray( array $expand = array(), array $intersect = array(), $showIdentifiers = false, $expandAll = 0 ) { $intersect = array_flip($intersect); $dateTimeFormat = \Utility\Registry::getConfigParam('DateTimeFormat'); $includeAll = empty($intersect); $data = array(); ($includeAll || isset($intersect['id'])) && $data['id'] = $this->id; ($includeAll || isset($intersect['createdBy'])) && $data['createdBy'] = (in_array('createdBy', $expand) || $expandAll || $showIdentifiers) && !is_null($this->createdBy) ? (!$showIdentifiers ? $this->createdBy->toArray( $expand, $intersect, $showIdentifiers, ($expandAll - 1) ) : $this->createdBy->id) : null; ($includeAll || isset($intersect['fromCompany'])) && $data['fromCompany'] = (in_array('fromCompany', $expand) || $expandAll || $showIdentifiers) && !is_null($this->fromCompany) ? (!$showIdentifiers ? $this->fromCompany->toArray( $expand, $intersect, $showIdentifiers, ($expandAll - 1) ) : $this->fromCompany->id) : null; ($includeAll || isset($intersect['againstCompany'])) && $data['againstCompany'] = (in_array('againstCompany', $expand) || $expandAll || $showIdentifiers) && !is_null($this->againstCompany) ? (!$showIdentifiers ? $this->againstCompany->toArray( $expand, $intersect, $showIdentifiers, ($expandAll - 1) ) : $this->againstCompany->id) : null; ($includeAll || isset($intersect['auction'])) && $data['auction'] = (in_array('auction', $expand) || $expandAll || $showIdentifiers) && !is_null($this->auction) ? (!$showIdentifiers ? $this->auction->toArray( $expand, $intersect, $showIdentifiers, ($expandAll - 1) ) : $this->auction->id) : null; ($includeAll || isset($intersect['complaint'])) && $data['complaint'] = $this->complaint; ($includeAll || isset($intersect['resolution'])) && $data['resolution'] = $this->resolution; ($includeAll || isset($intersect['jobState'])) && $data['jobState'] = $this->jobState; ($includeAll || isset($intersect['created'])) && $data['created'] = !is_null($this->created) ? $this->created->format($dateTimeFormat) : null; ($includeAll || isset($intersect['updated'])) && $data['updated'] = !is_null($this->updated) ? $this->updated->format($dateTimeFormat) : null; return $data; } /** * Populate from an array. * @param array $data */ public function fromArray($data = array()) { isset($data['id']) && $this->id = $data['id']; isset($data['createdBy']) && $this->createdBy = $data['createdBy']; isset($data['fromCompany']) && $this->fromCompany = $data['fromCompany']; isset($data['againstCompany']) && $this->againstCompany = $data['againstCompany']; isset($data['auction']) && $this->auction = $data['auction']; isset($data['complaint']) && $this->complaint = $data['complaint']; isset($data['resolution']) && $this->resolution = $data['resolution']; } }