cs: Fix code style (safe rules only).

This commit is contained in:
Pol Dellaiera
2021-11-23 14:06:38 +01:00
parent 149d7ce991
commit 8f96a1121d
1223 changed files with 65199 additions and 64625 deletions

View File

@@ -1,47 +1,55 @@
<?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/>.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\EventBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Chill\MainBundle\Entity\User;
use ArrayIterator;
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;
use Chill\MainBundle\Entity\Scope;
use Chill\MainBundle\Entity\User;
use DateTime;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Traversable;
/**
* Class Event
* Class Event.
*
* @package Chill\EventBundle\Entity
* @ORM\Entity(repositoryClass="Chill\EventBundle\Repository\EventRepository")
* @ORM\Table(name="chill_event_event")
* @ORM\HasLifecycleCallbacks()
* @ORM\HasLifecycleCallbacks
*/
class Event implements HasCenterInterface, HasScopeInterface
{
/**
* @var integer
* @var Center
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Center")
*/
private $center;
/**
* @var Scope
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope")
*/
private $circle;
/**
* @var DateTime
* @ORM\Column(type="datetime")
*/
private $date;
/**
* @var int
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
@@ -49,6 +57,12 @@ class Event implements HasCenterInterface, HasScopeInterface
*/
private $id;
/**
* @var User
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
*/
private $moderator;
/**
* @var string
* @ORM\Column(type="string", length=150)
@@ -56,48 +70,19 @@ class Event implements HasCenterInterface, HasScopeInterface
private $name;
/**
* @var \DateTime
* @ORM\Column(type="datetime")
* @var Participation
* @ORM\OneToMany(
* targetEntity="Chill\EventBundle\Entity\Participation",
* mappedBy="event")
*/
private $date;
private $participations;
/**
*
* @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.
*/
@@ -107,130 +92,8 @@ class Event implements HasCenterInterface, HasScopeInterface
}
/**
* Get id
* Add participation.
*
* @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)
@@ -241,40 +104,41 @@ class Event implements HasCenterInterface, HasScopeInterface
}
/**
* Remove participation
*
* @param Participation $participation
* @return Center
*/
public function removeParticipation(Participation $participation)
public function getCenter()
{
$this->participations->removeElement($participation);
return $this->center;
}
/**
* @return \ArrayIterator|\Traversable|Collection
* @return Scope
*/
public function getParticipations()
public function getCircle()
{
return $this->getParticipationsOrdered();
return $this->circle;
}
/**
* Sort Collection of Participations
* Get date.
*
* @return \ArrayIterator|\Traversable
* @return DateTime
*/
public function getParticipationsOrdered() {
$iterator = $this->participations->getIterator();
$iterator->uasort(function($first, $second)
{
return strnatcasecmp($first->getPerson()->getFirstName(), $second->getPerson()->getFirstName());
});
return $iterator;
public function getDate()
{
return $this->date;
}
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @return int
*/
@@ -282,14 +146,132 @@ class Event implements HasCenterInterface, HasScopeInterface
{
return $this->moderator;
}
/**
* Get label.
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @return ArrayIterator|Collection|Traversable
*/
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;
}
/**
* @deprecated
*
* @return Scope
*/
public function getScope()
{
return $this->getCircle();
}
/**
* @return EventType
*/
public function getType()
{
return $this->type;
}
/**
* Remove participation.
*/
public function removeParticipation(Participation $participation)
{
$this->participations->removeElement($participation);
}
/**
* @return $this
*/
public function setCenter(Center $center)
{
$this->center = $center;
return $this;
}
/**
* @return $this
*/
public function setCircle(Scope $circle)
{
$this->circle = $circle;
return $this;
}
/**
* Set date.
*
* @return Event
*/
public function setDate(DateTime $date)
{
$this->date = $date;
return $this;
}
/**
* @param int $moderator
*
* @return Event
*/
public function setModerator($moderator)
{
$this->moderator = $moderator;
return $this;
}
/**
* Set label.
*
* @param string $label
*
* @return Event
*/
public function setName($label)
{
$this->name = $label;
return $this;
}
/**
* @return $this
*/
public function setType(EventType $type)
{
$this->type = $type;
return $this;
}
}

View File

@@ -1,42 +1,35 @@
<?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/>.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\EventBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* Class EventType
* Class EventType.
*
* @package Chill\EventBundle\Entity
* @ORM\Entity()
* @ORM\Entity
* @ORM\Table(name="chill_event_event_type")
* @ORM\HasLifecycleCallbacks()
* @ORM\HasLifecycleCallbacks
*/
class EventType
{
/**
* @var integer
* @var bool
* @ORM\Column(type="boolean")
*/
private $active;
/**
* @var int
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
@@ -50,17 +43,11 @@ class EventType
*/
private $name;
/**
* @var boolean
* @ORM\Column(type="boolean")
*/
private $active;
/**
* @var Collection
* @ORM\OneToMany(
* targetEntity="Chill\EventBundle\Entity\Role",
* mappedBy="type")
* mappedBy="type")
*/
private $roles;
@@ -68,12 +55,12 @@ class EventType
* @var Collection
* @ORM\OneToMany(
* targetEntity="Chill\EventBundle\Entity\Status",
* mappedBy="type")
* mappedBy="type")
*/
private $statuses;
/**
* Constructor
* Constructor.
*/
public function __construct()
{
@@ -82,65 +69,8 @@ class EventType
}
/**
* Get id
* Add role.
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set label
*
* @param array $label
* @return EventType
*/
public function setName($label)
{
$this->name = $label;
return $this;
}
/**
* Get label
*
* @return array
*/
public function getName()
{
return $this->name;
}
/**
* Set active
*
* @param boolean $active
* @return EventType
*/
public function setActive($active)
{
$this->active = $active;
return $this;
}
/**
* Get active
*
* @return boolean
*/
public function getActive()
{
return $this->active;
}
/**
* Add role
*
* @param Role $role
* @return EventType
*/
public function addRole(Role $role)
@@ -151,24 +81,8 @@ class EventType
}
/**
* Remove role
* Add status.
*
* @param Role $role
*/
public function removeRole(Role $role)
{
$this->roles->removeElement($role);
}
public function getRoles()
{
return $this->roles;
}
/**
* Add status
*
* @param Status $status
* @return EventType
*/
public function addStatus(Status $status)
@@ -179,17 +93,42 @@ class EventType
}
/**
* Remove status
* Get active.
*
* @param Status $status
* @return bool
*/
public function removeStatus(Status $status)
public function getActive()
{
$this->statuses->removeElement($status);
return $this->active;
}
/**
* Get statuses
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Get label.
*
* @return array
*/
public function getName()
{
return $this->name;
}
public function getRoles()
{
return $this->roles;
}
/**
* Get statuses.
*
* @return Collection
*/
@@ -197,4 +136,48 @@ class EventType
{
return $this->statuses;
}
/**
* Remove role.
*/
public function removeRole(Role $role)
{
$this->roles->removeElement($role);
}
/**
* Remove status.
*/
public function removeStatus(Status $status)
{
$this->statuses->removeElement($status);
}
/**
* Set active.
*
* @param bool $active
*
* @return EventType
*/
public function setActive($active)
{
$this->active = $active;
return $this;
}
/**
* Set label.
*
* @param array $label
*
* @return EventType
*/
public function setName($label)
{
$this->name = $label;
return $this;
}
}

View File

@@ -1,47 +1,45 @@
<?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/>.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\EventBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use ArrayAccess;
use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Entity\HasCenterInterface;
use Chill\MainBundle\Entity\HasScopeInterface;
use Chill\MainBundle\Entity\Scope;
use Chill\PersonBundle\Entity\Person;
use Chill\MainBundle\Entity\HasScopeInterface;
use Chill\MainBundle\Entity\HasCenterInterface;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
use RuntimeException;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
/**
* Class Participation
* Class Participation.
*
* @package Chill\EventBundle\Entity
* @ORM\Entity(
* repositoryClass="Chill\EventBundle\Repository\ParticipationRepository")
* repositoryClass="Chill\EventBundle\Repository\ParticipationRepository")
* @ORM\Table(name="chill_event_participation")
* @ORM\HasLifecycleCallbacks()
* @ORM\HasLifecycleCallbacks
*/
class Participation implements HasCenterInterface, HasScopeInterface, \ArrayAccess
class Participation implements HasCenterInterface, HasScopeInterface, ArrayAccess
{
/**
* @var integer
* @var Event
* @ORM\ManyToOne(
* targetEntity="Chill\EventBundle\Entity\Event",
* inversedBy="participations")
*/
private $event;
/**
* @var int
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
@@ -50,18 +48,10 @@ class Participation implements HasCenterInterface, HasScopeInterface, \ArrayAcce
private $id;
/**
* @var \DateTime
* @var DateTime
* @ORM\Column(type="datetime")
*/
private $lastUpdate;
/**
* @var Event
* @ORM\ManyToOne(
* targetEntity="Chill\EventBundle\Entity\Event",
* inversedBy="participations")
*/
private $event;
/**
* @var Person
@@ -81,60 +71,21 @@ class Participation implements HasCenterInterface, HasScopeInterface, \ArrayAcce
*/
private $status;
/**
* Get id
*
* @return integer
* @return Center
*/
public function getId()
public function getCenter()
{
return $this->id;
}
/**
* Set lastUpdate
*
* @param \DateTime $lastUpdate
* @return Participation
*/
protected function update()
{
$this->lastUpdate = new \DateTime('now');
return $this;
}
/**
* Get lastUpdate
*
* @return \DateTime
*/
public function getLastUpdate()
{
return $this->lastUpdate;
}
/**
* Set event
*
* @param Event $event
* @return Participation
*/
public function setEvent(Event $event = null)
{
if ($this->event !== $event) {
$this->update();
if ($this->getEvent() === null) {
throw new RuntimeException('The event is not linked with this instance. '
. 'You should initialize the event with a valid center before.');
}
$this->event = $event;
return $this;
return $this->getEvent()->getCenter();
}
/**
* Get event
* Get event.
*
* @return Event
*/
@@ -144,24 +95,27 @@ class Participation implements HasCenterInterface, HasScopeInterface, \ArrayAcce
}
/**
* Set person
* Get id.
*
* @param Person $person
* @return Participation
* @return int
*/
public function setPerson(Person $person = null)
public function getId()
{
if ($person !== $this->person) {
$this->update();
}
$this->person = $person;
return $this;
return $this->id;
}
/**
* Get person
* Get lastUpdate.
*
* @return DateTime
*/
public function getLastUpdate()
{
return $this->lastUpdate;
}
/**
* Get person.
*
* @return Person
*/
@@ -171,12 +125,190 @@ class Participation implements HasCenterInterface, HasScopeInterface, \ArrayAcce
}
/**
* Set role
* Get role.
*
* @return Role
*/
public function getRole()
{
return $this->role;
}
/**
* @return Scope
*/
public function getScope()
{
if ($this->getEvent() === null) {
throw new RuntimeException('The event is not linked with this instance. '
. 'You should initialize the event with a valid center before.');
}
return $this->getEvent()->getCircle();
}
/**
* Get status.
*
* @return Status
*/
public function getStatus()
{
return $this->status;
}
/**
* Check that :.
*
* - the role can be associated with this event type
* - the status can be associated with this event type
*/
public function isConsistent(ExecutionContextInterface $context)
{
if ($this->getEvent() === null || $this->getRole() === null || $this->getStatus() === null) {
return;
}
if ($this->getRole()->getType()->getId() !==
$this->getEvent()->getType()->getId()) {
$context->buildViolation('The role is not allowed with this event type')
->atPath('role')
->addViolation();
}
if ($this->getStatus()->getType()->getId() !==
$this->getEvent()->getType()->getId()) {
$context->buildViolation('The status is not allowed with this event type')
->atPath('status')
->addViolation();
}
}
/**
* @param mixed $offset
*
* @return bool
*/
public function offsetExists($offset)
{
return in_array($offset, [
'person', 'role', 'status', 'event',
]);
}
/**
* @param mixed $offset
*
* @return Event|mixed|Person|Role|Status
*/
public function offsetGet($offset)
{
switch ($offset) {
case 'person':
return $this->getPerson();
break;
case 'role':
return $this->getRole();
break;
case 'status':
return $this->getStatus();
break;
case 'event':
return $this->getEvent();
break;
}
}
/**
* @param mixed $offset
* @param mixed $value
*
* @return Participation|void
*/
public function offsetSet($offset, $value)
{
switch ($offset) {
case 'person':
return $this->setPerson($value);
break;
case 'role':
return $this->setRole($value);
break;
case 'status':
return $this->setStatus($value);
break;
case 'event':
return $this->setEvent($value);
break;
}
}
/**
* @param mixed $offset
*/
public function offsetUnset($offset)
{
$this->offsetSet($offset, null);
}
/**
* Set event.
*
* @param Event $event
*
* @param Role $role
* @return Participation
*/
public function setRole(Role $role = null)
public function setEvent(?Event $event = null)
{
if ($this->event !== $event) {
$this->update();
}
$this->event = $event;
return $this;
}
/**
* Set person.
*
* @param Person $person
*
* @return Participation
*/
public function setPerson(?Person $person = null)
{
if ($person !== $this->person) {
$this->update();
}
$this->person = $person;
return $this;
}
/**
* Set role.
*
* @param Role $role
*
* @return Participation
*/
public function setRole(?Role $role = null)
{
if ($role !== $this->role) {
$this->update();
@@ -187,160 +319,32 @@ class Participation implements HasCenterInterface, HasScopeInterface, \ArrayAcce
}
/**
* Get role
*
* @return Role
*/
public function getRole()
{
return $this->role;
}
/**
* Set status
* Set status.
*
* @param Status $status
*
* @return Participation
*/
public function setStatus(Status $status = null)
public function setStatus(?Status $status = null)
{
if ($this->status !== $status) {
$this->update();
}
$this->status = $status;
return $this;
}
/**
* Get status
* Set lastUpdate.
*
* @return Status
* @return Participation
*/
public function getStatus()
protected function update()
{
return $this->status;
}
/**
* @return Center
*/
public function getCenter()
{
if ($this->getEvent() === NULL) {
throw new \RuntimeException('The event is not linked with this instance. '
. 'You should initialize the event with a valid center before.');
}
return $this->getEvent()->getCenter();
}
/**
* @return Scope
*/
public function getScope()
{
if ($this->getEvent() === NULL) {
throw new \RuntimeException('The event is not linked with this instance. '
. 'You should initialize the event with a valid center before.');
}
return $this->getEvent()->getCircle();
}
/**
* Check that :
*
* - the role can be associated with this event type
* - the status can be associated with this event type
*
* @param ExecutionContextInterface $context
*/
public function isConsistent(ExecutionContextInterface $context)
{
if ($this->getEvent() === NULL || $this->getRole() === NULL || $this->getStatus() === NULL) {
return;
}
if ($this->getRole()->getType()->getId() !==
$this->getEvent()->getType()->getId()) {
$context->buildViolation('The role is not allowed with this event type')
->atPath('role')
->addViolation();
}
if ($this->getStatus()->getType()->getId() !==
$this->getEvent()->getType()->getId()) {
$context->buildViolation('The status is not allowed with this event type')
->atPath('status')
->addViolation();
}
}
/**
* @param mixed $offset
* @return bool
*/
public function offsetExists($offset)
{
return in_array($offset, array(
'person', 'role', 'status', 'event'
));
}
/**
* @param mixed $offset
* @return Event|Role|Status|Person|mixed
*/
public function offsetGet($offset)
{
switch ($offset) {
case 'person':
return $this->getPerson();
break;
case 'role':
return $this->getRole();
break;
case 'status':
return $this->getStatus();
break;
case 'event':
return $this->getEvent();
break;
}
}
/**
* @param mixed $offset
* @param mixed $value
* @return Participation|void
*/
public function offsetSet($offset, $value)
{
switch($offset) {
case 'person':
return $this->setPerson($value);
break;
case 'role':
return $this->setRole($value);
break;
case 'status':
return $this->setStatus($value);
break;
case 'event':
return $this->setEvent($value);
break;
}
}
/**
* @param mixed $offset
*/
public function offsetUnset($offset)
{
$this->offsetSet($offset, null);
}
$this->lastUpdate = new DateTime('now');
return $this;
}
}

View File

@@ -1,22 +1,10 @@
<?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/>.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\EventBundle\Entity;
@@ -24,17 +12,22 @@ namespace Chill\EventBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Class Role
* Class Role.
*
* @package Chill\EventBundle\Entity
* @ORM\Entity()
* @ORM\Entity
* @ORM\Table(name="chill_event_role")
* @ORM\HasLifecycleCallbacks()
* @ORM\HasLifecycleCallbacks
*/
class Role
{
/**
* @var integer
* @var bool
* @ORM\Column(type="boolean")
*/
private $active;
/**
* @var int
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
@@ -48,25 +41,28 @@ class Role
*/
private $name;
/**
* @var boolean
* @ORM\Column(type="boolean")
*/
private $active;
/**
* @var EventType
* @ORM\ManyToOne(
* targetEntity="Chill\EventBundle\Entity\EventType",
* inversedBy="roles")
* inversedBy="roles")
*/
private $type;
/**
* Get active.
*
* @return bool
*/
public function getActive()
{
return $this->active;
}
/**
* Get id
* Get id.
*
* @return integer
* @return int
*/
public function getId()
{
@@ -74,20 +70,7 @@ class Role
}
/**
* Set label
*
* @param array $label
* @return Role
*/
public function setName($label)
{
$this->name = $label;
return $this;
}
/**
* Get label
* Get label.
*
* @return array
*/
@@ -97,9 +80,20 @@ class Role
}
/**
* Set active
* Get type.
*
* @return EventType
*/
public function getType()
{
return $this->type;
}
/**
* Set active.
*
* @param bool $active
*
* @param boolean $active
* @return Role
*/
public function setActive($active)
@@ -110,36 +104,30 @@ class Role
}
/**
* Get active
* Set label.
*
* @return boolean
*/
public function getActive()
{
return $this->active;
}
/**
* Set type
* @param array $label
*
* @param EventType $type
* @return Role
*/
public function setType(EventType $type = null)
public function setName($label)
{
$this->type = $type;
$this->name = $label;
return $this;
}
/**
* Get type
* Set type.
*
* @return EventType
* @param EventType $type
*
* @return Role
*/
public function getType()
public function setType(?EventType $type = null)
{
return $this->type;
$this->type = $type;
return $this;
}
}

View File

@@ -1,22 +1,10 @@
<?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/>.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\EventBundle\Entity;
@@ -24,17 +12,22 @@ namespace Chill\EventBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Class Status
* Class Status.
*
* @package Chill\EventBundle\Entity
* @ORM\Entity()
* @ORM\Entity
* @ORM\Table(name="chill_event_status")
* @ORM\HasLifecycleCallbacks()
* @ORM\HasLifecycleCallbacks
*/
class Status
{
/**
* @var integer
* @var bool
* @ORM\Column(type="boolean")
*/
private $active;
/**
* @var int
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
@@ -48,25 +41,28 @@ class Status
*/
private $name;
/**
* @var boolean
* @ORM\Column(type="boolean")
*/
private $active;
/**
* @var EventType
* @ORM\ManyToOne(
* targetEntity="Chill\EventBundle\Entity\EventType",
* inversedBy="statuses")
* inversedBy="statuses")
*/
private $type;
/**
* Get active.
*
* @return bool
*/
public function getActive()
{
return $this->active;
}
/**
* Get id
* Get id.
*
* @return integer
* @return int
*/
public function getId()
{
@@ -74,20 +70,7 @@ class Status
}
/**
* Set label
*
* @param array $name
* @return Status
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get label
* Get label.
*
* @return array
*/
@@ -96,11 +79,21 @@ class Status
return $this->name;
}
/**
* Get type.
*
* @return EventType
*/
public function getType()
{
return $this->type;
}
/**
* Set active
* Set active.
*
* @param bool $active
*
* @param boolean $active
* @return Status
*/
public function setActive($active)
@@ -111,36 +104,30 @@ class Status
}
/**
* Get active
* Set label.
*
* @return boolean
*/
public function getActive()
{
return $this->active;
}
/**
* Set type
* @param array $name
*
* @param EventType $type
* @return Status
*/
public function setType(EventType $type = null)
public function setName($name)
{
$this->type = $type;
$this->name = $name;
return $this;
}
/**
* Get type
* Set type.
*
* @return EventType
* @param EventType $type
*
* @return Status
*/
public function getType()
public function setType(?EventType $type = null)
{
return $this->type;
$this->type = $type;
return $this;
}
}