2018-12-18 09:44:39 +01:00
|
|
|
<?php
|
|
|
|
namespace Cadoles\CoreBundle\Entity;
|
|
|
|
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
|
|
|
|
|
|
use Symfony\Component\Security\Core\User\UserInterface;
|
|
|
|
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|
|
|
use Symfony\Component\Validator\Constraints as Assert;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ORM\Entity
|
|
|
|
* @ORM\Table(name="groupe")
|
|
|
|
* @ORM\HasLifecycleCallbacks()
|
2019-03-12 14:50:57 +01:00
|
|
|
* @ORM\Entity(repositoryClass="Cadoles\CoreBundle\Repository\GroupRepository")
|
|
|
|
*
|
2018-12-18 09:44:39 +01:00
|
|
|
* @UniqueEntity(fields="label", message="Un group existe déjà avec ce label")
|
|
|
|
*/
|
|
|
|
class Group
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @ORM\Column(type="integer")
|
|
|
|
* @ORM\Id
|
|
|
|
* @ORM\GeneratedValue(strategy="AUTO")
|
|
|
|
*/
|
|
|
|
private $id;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ORM\Column(type="string", length=250, unique=true)
|
|
|
|
*/
|
|
|
|
private $label;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ORM\Column(type="boolean")
|
|
|
|
*/
|
|
|
|
private $fgopen;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ORM\Column(type="boolean")
|
|
|
|
*/
|
|
|
|
private $fgall;
|
2019-03-12 14:50:57 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @ORM\Column(type="boolean")
|
|
|
|
*/
|
|
|
|
private $fgtemplate;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ORM\Column(type="text", nullable=true)
|
|
|
|
*/
|
|
|
|
private $ldapfilter;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ORM\Column(type="text", nullable=true)
|
|
|
|
*/
|
|
|
|
private $attributes;
|
|
|
|
|
2018-12-18 09:44:39 +01:00
|
|
|
/**
|
|
|
|
* @var ArrayCollection $users
|
|
|
|
* @var UserGroup
|
|
|
|
*
|
|
|
|
* @ORM\OneToMany(targetEntity="UserGroup", mappedBy="group", cascade={"persist"}, orphanRemoval=true)
|
|
|
|
*/
|
|
|
|
private $users;
|
|
|
|
|
2019-03-12 14:50:57 +01:00
|
|
|
|
|
|
|
|
2018-12-18 09:44:39 +01:00
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
*/
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
$this->users = new \Doctrine\Common\Collections\ArrayCollection();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get id
|
|
|
|
*
|
|
|
|
* @return integer
|
|
|
|
*/
|
|
|
|
public function getId()
|
|
|
|
{
|
|
|
|
return $this->id;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set label
|
|
|
|
*
|
|
|
|
* @param string $label
|
|
|
|
*
|
|
|
|
* @return Group
|
|
|
|
*/
|
|
|
|
public function setLabel($label)
|
|
|
|
{
|
|
|
|
$this->label = $label;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get label
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getLabel()
|
|
|
|
{
|
|
|
|
return $this->label;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set fgopen
|
|
|
|
*
|
|
|
|
* @param boolean $fgopen
|
|
|
|
*
|
|
|
|
* @return Group
|
|
|
|
*/
|
|
|
|
public function setFgopen($fgopen)
|
|
|
|
{
|
|
|
|
$this->fgopen = $fgopen;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get fgopen
|
|
|
|
*
|
|
|
|
* @return boolean
|
|
|
|
*/
|
|
|
|
public function getFgopen()
|
|
|
|
{
|
|
|
|
return $this->fgopen;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set fgall
|
|
|
|
*
|
|
|
|
* @param boolean $fgall
|
|
|
|
*
|
|
|
|
* @return Group
|
|
|
|
*/
|
|
|
|
public function setFgall($fgall)
|
|
|
|
{
|
|
|
|
$this->fgall = $fgall;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get fgall
|
|
|
|
*
|
|
|
|
* @return boolean
|
|
|
|
*/
|
|
|
|
public function getFgall()
|
|
|
|
{
|
|
|
|
return $this->fgall;
|
|
|
|
}
|
|
|
|
|
2019-03-12 14:50:57 +01:00
|
|
|
/**
|
|
|
|
* Set fgtemplate
|
|
|
|
*
|
|
|
|
* @param boolean $fgtemplate
|
|
|
|
*
|
|
|
|
* @return Group
|
|
|
|
*/
|
|
|
|
public function setFgtemplate($fgtemplate)
|
|
|
|
{
|
|
|
|
$this->fgtemplate = $fgtemplate;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get fgtemplate
|
|
|
|
*
|
|
|
|
* @return boolean
|
|
|
|
*/
|
|
|
|
public function getFgtemplate()
|
|
|
|
{
|
|
|
|
return $this->fgtemplate;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set ldapfilter
|
|
|
|
*
|
|
|
|
* @param string $ldapfilter
|
|
|
|
*
|
|
|
|
* @return Group
|
|
|
|
*/
|
|
|
|
public function setLdapfilter($ldapfilter)
|
|
|
|
{
|
|
|
|
$this->ldapfilter = $ldapfilter;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get ldapfilter
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getLdapfilter()
|
|
|
|
{
|
|
|
|
return $this->ldapfilter;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set attributes
|
|
|
|
*
|
|
|
|
* @param string $attributes
|
|
|
|
*
|
|
|
|
* @return Group
|
|
|
|
*/
|
|
|
|
public function setAttributes($attributes)
|
|
|
|
{
|
|
|
|
$this->attributes = $attributes;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get attributes
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getAttributes()
|
|
|
|
{
|
|
|
|
return $this->attributes;
|
|
|
|
}
|
|
|
|
|
2018-12-18 09:44:39 +01:00
|
|
|
/**
|
|
|
|
* Add user
|
|
|
|
*
|
|
|
|
* @param \Cadoles\CoreBundle\Entity\UserGroup $user
|
|
|
|
*
|
|
|
|
* @return Group
|
|
|
|
*/
|
|
|
|
public function addUser(\Cadoles\CoreBundle\Entity\UserGroup $user)
|
|
|
|
{
|
|
|
|
$this->users[] = $user;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove user
|
|
|
|
*
|
|
|
|
* @param \Cadoles\CoreBundle\Entity\UserGroup $user
|
|
|
|
*/
|
|
|
|
public function removeUser(\Cadoles\CoreBundle\Entity\UserGroup $user)
|
|
|
|
{
|
|
|
|
$this->users->removeElement($user);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get users
|
|
|
|
*
|
|
|
|
* @return \Doctrine\Common\Collections\Collection
|
|
|
|
*/
|
|
|
|
public function getUsers()
|
|
|
|
{
|
|
|
|
return $this->users;
|
|
|
|
}
|
|
|
|
}
|