chill-bundles/Entity/Scope.php

116 lines
2.6 KiB
PHP

<?php
/*
* Chill is a suite of a modules, 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\MainBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
use Chill\MainBundle\Entity\RoleScope;
/**
* @ORM\Entity()
* @ORM\Table(name="scopes")
* @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="acl_cache_region")
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
*/
class Scope
{
/**
* @var integer
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* translatable names
*
* @var array
*
* @ORM\Column(type="json_array")
*/
private $name = [];
/**
* @var Collection
*
* @ORM\OneToMany(
* targetEntity="Chill\MainBundle\Entity\RoleScope",
* mappedBy="scope")
* @ORM\Cache(usage="NONSTRICT_READ_WRITE")
*/
private $roleScopes;
/**
* Scope constructor.
*/
public function __construct()
{
$this->roleScopes = new ArrayCollection();
}
/**
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @return array
*/
public function getName()
{
return $this->name;
}
/**
* @param $name
* @return $this
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* @return Collection
*/
public function getRoleScopes()
{
return $this->roleScopes;
}
/**
* @param RoleScope $roleScope
*/
public function addRoleScope(RoleScope $roleScope)
{
$this->roleScopes->add($roleScope);
}
}