reasons = new ArrayCollection(); } /** * @return string */ public function __toString() { return 'ActivityReasonCategory(' . $this->getName('x') . ')'; } /** * Get active. * * @return bool */ public function getActive() { return $this->active; } /** * Get id. * * @return int */ public function getId() { return $this->id; } /** * Get name. * * @param mixed|null $locale * * @return array */ public function getName($locale = null) { if ($locale) { if (isset($this->name[$locale])) { return $this->name[$locale]; } foreach ($this->name as $name) { if (!empty($name)) { return $name; } } return ''; } return $this->name; } /** * Declare a category as active (or not). When a category is set * as unactive, all the reason have this entity as category is also * set as unactive. * * @param bool $active * * @return ActivityReasonCategory */ public function setActive($active) { if ($this->active !== $active && !$active) { foreach ($this->reasons as $reason) { $reason->setActive($active); } } $this->active = $active; return $this; } /** * Set name. * * @param array $name * * @return ActivityReasonCategory */ public function setName($name) { $this->name = $name; return $this; } }