$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() { if (is_null($this->company)) { $this->company = \Utility\Registry::resolveCompanyContext($this->company); } if (is_null($this->profile)) { $this->profile = \Utility\Registry::resolveProfileContext($this->profile); } $this->created = new \DateTime("now"); } /** * @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['priceGuideStock'])) && $data['priceGuideStock'] = (in_array('priceGuideStock', $expand) || $expandAll || $showIdentifiers) && !is_null($this->priceGuideStock) ? (!$showIdentifiers ? $this->priceGuideStock->toArray( $expand, $intersect, $showIdentifiers, ($expandAll - 1) ) : $this->priceGuideStock->id) : null; ($includeAll || isset($intersect['company'])) && $data['company'] = (in_array('company', $expand) || $expandAll || $showIdentifiers) && !is_null($this->company) ? (!$showIdentifiers ? $this->company->toArray( $expand, $intersect, $showIdentifiers, ($expandAll - 1) ) : $this->company->id) : null; ($includeAll || isset($intersect['profile'])) && $data['profile'] = (in_array('profile', $expand) || $expandAll || $showIdentifiers) && !is_null($this->profile) ? (!$showIdentifiers ? $this->profile->toArray( $expand, $intersect, $showIdentifiers, ($expandAll - 1) ) : $this->profile->id) : null; ($includeAll || isset($intersect['amount'])) && $data['amount'] = $this->amount; ($includeAll || isset($intersect['status'])) && $data['status'] = $this->status; ($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['priceGuideStock']) && $this->priceGuideStock = $data['priceGuideStock']; isset($data['company']) && $this->company = $data['company']; isset($data['profile']) && $this->profile = $data['profile']; isset($data['amount']) && $this->amount = $data['amount']; isset($data['status']) && $this->status = $data['status']; } }