mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-07-01 06:26:15 +00:00
Category unactive implies all the reasons with this category as unactive - refs #622
This commit is contained in:
parent
0ecfcae98b
commit
744a68f195
@ -20,6 +20,8 @@
|
||||
|
||||
namespace Chill\ActivityBundle\Entity;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
/**
|
||||
* ActivityReasonCategory
|
||||
*/
|
||||
@ -40,13 +42,19 @@ class ActivityReasonCategory
|
||||
*/
|
||||
private $active;
|
||||
|
||||
/** @var ArrayCollection array of ActivityReason */
|
||||
private $reasons;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->reasons = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return 'blop';
|
||||
return 'ActivityReasonCategory('.$this->getName('x').')';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
@ -95,14 +103,21 @@ class ActivityReasonCategory
|
||||
}
|
||||
|
||||
/**
|
||||
* Set active
|
||||
* 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 boolean $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;
|
||||
|
@ -12,4 +12,8 @@ Chill\ActivityBundle\Entity\ActivityReasonCategory:
|
||||
type: json_array
|
||||
active:
|
||||
type: boolean
|
||||
oneToMany:
|
||||
reasons:
|
||||
targetEntity: Chill\ActivityBundle\Entity\ActivityReason
|
||||
mappedBy: category
|
||||
lifecycleCallbacks: { }
|
||||
|
Loading…
x
Reference in New Issue
Block a user