1 <?php
declare(strict_types
=1);
4 * This file is part of the Rapsys TreeBundle package.
6 * (c) Raphaël Gertz <symfony@rapsys.eu>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Rapsys\TreeBundle\Entity
;
14 use Doctrine\Common\Collections\Collection
;
15 use Doctrine\Common\Collections\ArrayCollection
;
17 use Rapsys\UserBundle\Entity\User
as BaseUser
;
22 class User
extends BaseUser
{
24 * @var \Doctrine\Common\Collections\Collection
26 private Collection
$resources;
31 * @param string $mail The user mail
32 * @param string $password The user password
33 * @param ?Civility $civility The user civility
34 * @param ?string $forename The user forename
35 * @param ?string $surname The user surname
36 * @param bool $active The user is active
37 * @param bool $enable The user is enable
38 * @param ?string $pseudonym The user pseudonym
39 * @param ?string $slug The user slug
41 public function __construct(string $mail, string $password, ?Civility
$civility = null, ?string $forename = null, ?string $surname = null, bool $active = false, bool $enable = true, ?string $pseudonym = null, ?string $slug = null) {
42 //Call parent constructor
43 parent
::__construct($mail, $password, $civility, $forename, $surname, $active, $enable);
48 $this->resources
= new ArrayCollection();
54 * @param Resource $resource
58 public function addResource(Resource $resource): User
{
59 $this->resources
[] = $resource;
67 * @param Resource $resource
69 * @return \Doctrine\Common\Collections\Collection
71 public function removeResource(Resource $resource): Collection
{
72 return $this->resources
->removeElement($resource);
78 * @return \Doctrine\Common\Collections\Collection
80 public function getResources(): Collection
{
81 return $this->resources
;