regionalManagers = new \Doctrine\Common\Collections\ArrayCollection(); $this->divisions = new \Doctrine\Common\Collections\ArrayCollection(); $this->companies = new \Doctrine\Common\Collections\ArrayCollection(); } /** * Add a new division to this group. * @param Town $town * @return \Location\Entity\Region */ public function addDivision(GroupDivision $division) { $this->divisions[] = $division; return $this; } /** * Magic getter to expose protected properties. * @param string $property * @return mixed */ public function __get($property) { return $this->$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"); } /** * @ORM\PreUpdate */ public function setUpdateTime() { $this->updated = new \DateTime("now"); } /** * Convert the object to an array. * @param array $expand * @param array $intersect * @return array */ public function toArray(array $expand = array(), array $intersect = array()) { $dateTimeFormat = \Utility\Registry::getConfigParam('DateTimeFormat'); $includeAll = empty($intersect); $data = array(); ($includeAll || isset($intersect['id'])) && $data['id'] = $this->id; ($includeAll || isset($intersect['name'])) && $data['name'] = $this->name; ($includeAll || isset($intersect['logo'])) && $data['logo'] = in_array('logo', $expand) && !is_null($this->logo) ? $this->logo->toArray($expand, $intersect) : null; ($includeAll || isset($intersect['watermark'])) && $data['watermark'] = in_array('watermark', $expand) && !is_null($this->watermark) ? $this->watermark->toArray($expand, $intersect) : null; ($includeAll || isset($intersect['numberOfDealers'])) && $data['numberOfDealers'] = $this->numberOfDealers; ($includeAll || isset($intersect['pricingType'])) && $data['pricingType'] = $this->pricingType; ($includeAll || isset($intersect['landingPage'])) && $data['landingPage'] = $this->landingPage; ($includeAll || isset($intersect['fixedPricing'])) && $data['fixedPricing'] = $this->fixedPricing; ($includeAll || isset($intersect['priceGuide'])) && $data['priceGuide'] = $this->priceGuide; ($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['name']) && $this->name = $data['name']; isset($data['logo']) && $this->logo = $data['logo']; isset($data['watermark']) && $this->watermark = $data['watermark']; isset($data['numberOfDealers']) && $this->numberOfDealers = $data['numberOfDealers']; isset($data['pricingType']) && $this->pricingType = $data['pricingType']; isset($data['fixedPricing']) && $this->fixedPricing = $data['fixedPricing']; isset($data['priceGuide']) && $this->priceGuide = $data['priceGuide']; isset($data['landingPage']) && $this->landingPage = $data['landingPage']; } }