]> Raphaël G. Git Repositories - treebundle/blob - Entity/User.php
Remove title member
[treebundle] / Entity / User.php
1 <?php declare(strict_types=1);
2
3 /*
4 * This file is part of the Rapsys TreeBundle package.
5 *
6 * (c) Raphaël Gertz <symfony@rapsys.eu>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Rapsys\TreeBundle\Entity;
13
14 use Doctrine\Common\Collections\Collection;
15 use Doctrine\Common\Collections\ArrayCollection;
16
17 use Rapsys\UserBundle\Entity\User as BaseUser;
18
19 /**
20 * {@inheritdoc}
21 */
22 class User extends BaseUser {
23 /**
24 * @var \Doctrine\Common\Collections\Collection
25 */
26 private Collection $resources;
27
28 /**
29 * Constructor
30 *
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
40 */
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);
44
45 //Set defaults
46
47 //Set collections
48 $this->resources = new ArrayCollection();
49 }
50
51 /**
52 * Add resource
53 *
54 * @param Resource $resource
55 *
56 * @return User
57 */
58 public function addResource(Resource $resource): User {
59 $this->resources[] = $resource;
60
61 return $this;
62 }
63
64 /**
65 * Remove resource
66 *
67 * @param Resource $resource
68 *
69 * @return \Doctrine\Common\Collections\Collection
70 */
71 public function removeResource(Resource $resource): Collection {
72 return $this->resources->removeElement($resource);
73 }
74
75 /**
76 * Get resources
77 *
78 * @return \Doctrine\Common\Collections\Collection
79 */
80 public function getResources(): Collection {
81 return $this->resources;
82 }
83 }