chill-bundles/Entity/EventType.php

206 lines
3.8 KiB
PHP

<?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 Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
/**
* Class EventType
*
* @package Chill\EventBundle\Entity
* @ORM\Entity()
* @ORM\Table(name="chill_event_event_type")
* @ORM\HasLifecycleCallbacks()
*/
class EventType
{
/**
* @var integer
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var array
* @ORM\Column(type="json_array")
*/
private $name;
/**
* @var boolean
* @ORM\Column(type="boolean")
*/
private $active;
/**
* @var Collection
* @ORM\OneToMany(
* targetEntity="Chill\EventBundle\Entity\Role",
* mappedBy="type")
*/
private $roles;
/**
* @var Collection
* @ORM\OneToMany(
* targetEntity="Chill\EventBundle\Entity\Status",
* mappedBy="type")
*/
private $statuses;
/**
* Constructor
*/
public function __construct()
{
$this->roles = new ArrayCollection();
$this->statuses = new ArrayCollection();
}
/**
* Get id
*
* @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)
{
$this->roles[] = $role;
return $this;
}
/**
* Remove role
*
* @param Role $role
*/
public function removeRole(Role $role)
{
$this->roles->removeElement($role);
}
/**
* Get roles
*
* @return Collection
*/
public function getRoles()
{
return $this->roles;
}
/**
* Add status
*
* @param Status $status
* @return EventType
*/
public function addStatus(Status $status)
{
$this->statuses[] = $status;
return $this;
}
/**
* Remove status
*
* @param Status $status
*/
public function removeStatus(Status $status)
{
$this->statuses->removeElement($status);
}
/**
* Get statuses
*
* @return Collection
*/
public function getStatuses()
{
return $this->statuses;
}
}