mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 18:43:49 +00:00
fix folder name
This commit is contained in:
295
src/Bundle/ChillEventBundle/Entity/Event.php
Normal file
295
src/Bundle/ChillEventBundle/Entity/Event.php
Normal file
@@ -0,0 +1,295 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace Chill\EventBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Entity\Center;
|
||||
use Chill\MainBundle\Entity\Scope;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Chill\MainBundle\Entity\HasCenterInterface;
|
||||
use Chill\MainBundle\Entity\HasScopeInterface;
|
||||
|
||||
/**
|
||||
* Class Event
|
||||
*
|
||||
* @package Chill\EventBundle\Entity
|
||||
* @ORM\Entity(repositoryClass="Chill\EventBundle\Repository\EventRepository")
|
||||
* @ORM\Table(name="chill_event_event")
|
||||
* @ORM\HasLifecycleCallbacks()
|
||||
*/
|
||||
class Event implements HasCenterInterface, HasScopeInterface
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Id
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @ORM\Column(type="string", length=150)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var \DateTime
|
||||
* @ORM\Column(type="datetime")
|
||||
*/
|
||||
private $date;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var Center
|
||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Center")
|
||||
*/
|
||||
private $center;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var EventType
|
||||
* @ORM\ManyToOne(targetEntity="Chill\EventBundle\Entity\EventType")
|
||||
*/
|
||||
private $type;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var Scope
|
||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope")
|
||||
*/
|
||||
private $circle;
|
||||
|
||||
/**
|
||||
* @var Participation
|
||||
* @ORM\OneToMany(
|
||||
* targetEntity="Chill\EventBundle\Entity\Participation",
|
||||
* mappedBy="event")
|
||||
*/
|
||||
private $participations;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var User
|
||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
|
||||
*/
|
||||
private $moderator;
|
||||
|
||||
|
||||
/**
|
||||
* Event constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->participations = new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set label
|
||||
*
|
||||
* @param string $label
|
||||
* @return Event
|
||||
*/
|
||||
public function setName($label)
|
||||
{
|
||||
$this->name = $label;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get label
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set date
|
||||
*
|
||||
* @param \DateTime $date
|
||||
* @return Event
|
||||
*/
|
||||
public function setDate(\DateTime $date)
|
||||
{
|
||||
$this->date = $date;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get date
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getDate()
|
||||
{
|
||||
return $this->date;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Center $center
|
||||
* @return $this
|
||||
*/
|
||||
public function setCenter(Center $center)
|
||||
{
|
||||
$this->center = $center;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return EventType
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param EventType $type
|
||||
* @return $this
|
||||
*/
|
||||
public function setType(EventType $type)
|
||||
{
|
||||
$this->type = $type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Center
|
||||
*/
|
||||
public function getCenter()
|
||||
{
|
||||
return $this->center;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Scope
|
||||
*/
|
||||
public function getCircle()
|
||||
{
|
||||
return $this->circle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Scope $circle
|
||||
* @return $this
|
||||
*/
|
||||
public function setCircle(\Chill\MainBundle\Entity\Scope $circle)
|
||||
{
|
||||
$this->circle = $circle;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @return Scope
|
||||
*/
|
||||
public function getScope()
|
||||
{
|
||||
return $this->getCircle();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add participation
|
||||
*
|
||||
* @param Participation $participation
|
||||
* @return Event
|
||||
*/
|
||||
public function addParticipation(Participation $participation)
|
||||
{
|
||||
$this->participations[] = $participation;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove participation
|
||||
*
|
||||
* @param Participation $participation
|
||||
*/
|
||||
public function removeParticipation(Participation $participation)
|
||||
{
|
||||
$this->participations->removeElement($participation);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \ArrayIterator|\Traversable|Collection
|
||||
*/
|
||||
public function getParticipations()
|
||||
{
|
||||
return $this->getParticipationsOrdered();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort Collection of Participations
|
||||
*
|
||||
* @return \ArrayIterator|\Traversable
|
||||
*/
|
||||
public function getParticipationsOrdered() {
|
||||
|
||||
$iterator = $this->participations->getIterator();
|
||||
|
||||
$iterator->uasort(function($first, $second)
|
||||
{
|
||||
return strnatcasecmp($first->getPerson()->getFirstName(), $second->getPerson()->getFirstName());
|
||||
});
|
||||
|
||||
return $iterator;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getModerator()
|
||||
{
|
||||
return $this->moderator;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $moderator
|
||||
* @return Event
|
||||
*/
|
||||
public function setModerator($moderator)
|
||||
{
|
||||
$this->moderator = $moderator;
|
||||
return $this;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user