mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
127 lines
2.8 KiB
PHP
127 lines
2.8 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;
|
|
|
|
/**
|
|
* @ORM\Entity()
|
|
* @ORM\Table(name="role_scopes")
|
|
* @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="acl_cache_region")
|
|
*
|
|
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
|
*/
|
|
class RoleScope
|
|
{
|
|
/**
|
|
* @var integer
|
|
*
|
|
* @ORM\Id
|
|
* @ORM\Column(name="id", type="integer")
|
|
* @ORM\GeneratedValue(strategy="AUTO")
|
|
*/
|
|
private $id;
|
|
|
|
/**
|
|
* @var string
|
|
*
|
|
* @ORM\Column(type="string", length=255)
|
|
*/
|
|
private $role;
|
|
|
|
/**
|
|
* @var Scope
|
|
*
|
|
* @ORM\ManyToOne(
|
|
* targetEntity="Chill\MainBundle\Entity\Scope",
|
|
* inversedBy="roleScopes")
|
|
* @ORM\JoinColumn(nullable=true, name="scope_id")
|
|
* @ORM\Cache(usage="NONSTRICT_READ_WRITE")
|
|
*/
|
|
private $scope;
|
|
|
|
/**
|
|
* @var Collection
|
|
*
|
|
* @ORM\ManyToMany(
|
|
* targetEntity="Chill\MainBundle\Entity\PermissionsGroup",
|
|
* mappedBy="roleScopes")
|
|
*/
|
|
private $permissionsGroups;
|
|
|
|
|
|
/**
|
|
* RoleScope constructor.
|
|
*/
|
|
public function __construct() {
|
|
$this->new = true;
|
|
$this->permissionsGroups = new ArrayCollection();
|
|
}
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getId()
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getRole()
|
|
{
|
|
return $this->role;
|
|
}
|
|
|
|
/**
|
|
* @return Scope
|
|
*/
|
|
public function getScope()
|
|
{
|
|
return $this->scope;
|
|
}
|
|
|
|
/**
|
|
* @param type $role
|
|
* @return RoleScope
|
|
*/
|
|
public function setRole($role)
|
|
{
|
|
$this->role = $role;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @param Scope $scope
|
|
* @return RoleScope
|
|
*/
|
|
public function setScope(Scope $scope = null)
|
|
{
|
|
$this->scope = $scope;
|
|
|
|
return $this;
|
|
}
|
|
}
|