adding a scope/circle to events

ref #1
This commit is contained in:
Julien Fastré 2016-03-22 12:36:11 +01:00
parent d7fc04cdaa
commit e66a855c0a
3 changed files with 45 additions and 0 deletions

View File

@ -8,6 +8,7 @@ use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Chill\EventBundle\Entity\Participation;
use Chill\MainBundle\Entity\Center;
use Chill\EventBundle\Entity\Event;
use Chill\MainBundle\DataFixtures\ORM\LoadScopes;
/**
* Load Events and Participation
@ -82,6 +83,11 @@ class LoadParticipation extends AbstractFixture implements OrderedFixtureInterfa
->setLabel($this->faker->words(rand(2,4), true))
->setType($this->getReference(LoadEventTypes::$refs[array_rand(LoadEventTypes::$refs)]))
->setCenter($center)
->setCircle(
$this->getReference(
LoadScopes::$references[array_rand(LoadScopes::$references)]
)
)
;
$manager->persist($event);
$events[] = $event;

View File

@ -34,6 +34,12 @@ class Event
*/
private $type;
/**
*
* @var \Chill\MainBundle\Entity\Scope
*/
private $circle;
/**
* @var \Doctrine\Common\Collections\Collection
*/
@ -141,7 +147,38 @@ class Event
{
return $this->center;
}
/**
*
* @return \Chill\MainBundle\Entity\Scope
*/
public function getCircle()
{
return $this->circle;
}
/**
*
* @param \Chill\MainBundle\Entity\Scope $circle
* @return \Chill\EventBundle\Entity\Event
*/
public function setCircle(\Chill\MainBundle\Entity\Scope $circle)
{
$this->circle = $circle;
return $this;
}
/**
*
* @deprecated
* @return \Chill\MainBundle\Entity\Scope
*/
public function getScope()
{
return $this->getCircle();
}
/**
* Add participation
*

View File

@ -22,4 +22,6 @@ Chill\EventBundle\Entity\Event:
targetEntity: Chill\MainBundle\Entity\Center
type:
targetEntity: Chill\EventBundle\Entity\EventType
circle:
targetEntity: Chill\MainBundle\Entity\Scope
lifecycleCallbacks: { }