mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-01 04:23:49 +00:00
An activity may have multiple reasons
The relationship between Activity and Reasons is now many-to-many. Some improvement in show activity layout. refs #4 #7
This commit is contained in:
@@ -27,6 +27,7 @@ use Chill\ActivityBundle\Entity\ActivityType;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\MainBundle\Entity\HasCenterInterface;
|
||||
use Chill\MainBundle\Entity\HasScopeInterface;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
/**
|
||||
* Activity
|
||||
@@ -64,9 +65,9 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
||||
private $attendee;
|
||||
|
||||
/**
|
||||
* @var ActivityReason
|
||||
* @var \Doctrine\Common\Collections\Collection
|
||||
*/
|
||||
private $reason;
|
||||
private $reasons;
|
||||
|
||||
/**
|
||||
* @var ActivityType
|
||||
@@ -82,6 +83,11 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
||||
* @var Person
|
||||
*/
|
||||
private $person;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->reasons = new ArrayCollection();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -215,27 +221,32 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Set reason
|
||||
* Add a reason
|
||||
*
|
||||
* @param ActivityReason $reason
|
||||
*
|
||||
* @return Activity
|
||||
*/
|
||||
public function setReason(ActivityReason $reason)
|
||||
public function addReason(ActivityReason $reason)
|
||||
{
|
||||
$this->reason = $reason;
|
||||
$this->reasons[] = $reason;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeReason(ActivityReason $reason)
|
||||
{
|
||||
$this->reasons->removeElement($reason);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get reason
|
||||
* Get reasons
|
||||
*
|
||||
* @return ActivityReason
|
||||
* @return \Doctrine\Common\Collections\Collection
|
||||
*/
|
||||
public function getReason()
|
||||
public function getReasons()
|
||||
{
|
||||
return $this->reason;
|
||||
return $this->reasons;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user