sf4 deprecated: migrate Doctrine ORM mapping to annotation

This commit is contained in:
2020-07-24 18:57:58 +02:00
parent c8c76e5a8d
commit ad8c1bbe9f
10 changed files with 291 additions and 212 deletions

View File

@@ -1,67 +1,111 @@
<?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;
/**
* Event
* 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 \Chill\MainBundle\Entity\Center
* @var Center
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Center")
*/
private $center;
/**
*
* @var EventType
* @ORM\ManyToOne(targetEntity="Chill\EventBundle\Entity\EventType")
*/
private $type;
/**
*
* @var \Chill\MainBundle\Entity\Scope
* @var Scope
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope")
*/
private $circle;
/**
* @var \Doctrine\Common\Collections\Collection
* @var Participation
* @ORM\OneToMany(
* targetEntity="Chill\EventBundle\Entity\Participation",
* mappedBy="event")
*/
private $participations;
/**
* @var integer
*
* @var User
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
*/
private $moderator;
/**
* Constructor
* Event constructor.
*/
public function __construct()
{
$this->participations = new \Doctrine\Common\Collections\ArrayCollection();
$this->participations = new ArrayCollection();
}
/**
* Get id
*
@@ -76,7 +120,6 @@ class Event implements HasCenterInterface, HasScopeInterface
* Set label
*
* @param string $label
*
* @return Event
*/
public function setName($label)
@@ -100,7 +143,6 @@ class Event implements HasCenterInterface, HasScopeInterface
* Set date
*
* @param \DateTime $date
*
* @return Event
*/
public function setDate(\DateTime $date)
@@ -120,7 +162,11 @@ class Event implements HasCenterInterface, HasScopeInterface
return $this->date;
}
public function setCenter(\Chill\MainBundle\Entity\Center $center)
/**
* @param Center $center
* @return $this
*/
public function setCenter(Center $center)
{
$this->center = $center;
@@ -128,7 +174,6 @@ class Event implements HasCenterInterface, HasScopeInterface
}
/**
*
* @return EventType
*/
public function getType()
@@ -137,9 +182,8 @@ class Event implements HasCenterInterface, HasScopeInterface
}
/**
*
* @param \Chill\EventBundle\Entity\EventType $type
* @return \Chill\EventBundle\Entity\Event
* @param EventType $type
* @return $this
*/
public function setType(EventType $type)
{
@@ -148,8 +192,7 @@ class Event implements HasCenterInterface, HasScopeInterface
}
/**
*
* @return \Chill\MainBundle\Entity\Center
* @return Center
*/
public function getCenter()
{
@@ -157,8 +200,7 @@ class Event implements HasCenterInterface, HasScopeInterface
}
/**
*
* @return \Chill\MainBundle\Entity\Scope
* @return Scope
*/
public function getCircle()
{
@@ -166,9 +208,8 @@ class Event implements HasCenterInterface, HasScopeInterface
}
/**
*
* @param \Chill\MainBundle\Entity\Scope $circle
* @return \Chill\EventBundle\Entity\Event
* @param Scope $circle
* @return $this
*/
public function setCircle(\Chill\MainBundle\Entity\Scope $circle)
{
@@ -177,9 +218,8 @@ class Event implements HasCenterInterface, HasScopeInterface
}
/**
*
* @deprecated
* @return \Chill\MainBundle\Entity\Scope
* @return Scope
*/
public function getScope()
{
@@ -190,11 +230,10 @@ class Event implements HasCenterInterface, HasScopeInterface
/**
* Add participation
*
* @param \Chill\EventBundle\Entity\Participation $participation
*
* @param Participation $participation
* @return Event
*/
public function addParticipation(\Chill\EventBundle\Entity\Participation $participation)
public function addParticipation(Participation $participation)
{
$this->participations[] = $participation;
@@ -204,17 +243,15 @@ class Event implements HasCenterInterface, HasScopeInterface
/**
* Remove participation
*
* @param \Chill\EventBundle\Entity\Participation $participation
* @param Participation $participation
*/
public function removeParticipation(\Chill\EventBundle\Entity\Participation $participation)
public function removeParticipation(Participation $participation)
{
$this->participations->removeElement($participation);
}
/**
* Get participations
*
* @return \ArrayIterator|\Doctrine\Common\Collections\Collection|\Traversable
* @return \ArrayIterator|\Traversable|Collection
*/
public function getParticipations()
{