]> Raphaël G. Git Repositories - treebundle/blob - Entity/User.php
Add missing uses
[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 $assets;
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->assets = new ArrayCollection();
49 }
50
51 /**
52 * Add asset
53 *
54 * @param Asset $asset
55 *
56 * @return User
57 */
58 public function addAsset(Asset $asset): User {
59 $this->assets[] = $asset;
60
61 return $this;
62 }
63
64 /**
65 * Remove asset
66 *
67 * @param Asset $asset
68 *
69 * @return \Doctrine\Common\Collections\Collection
70 */
71 public function removeAsset(Asset $asset): Collection {
72 return $this->assets->removeElement($asset);
73 }
74
75 /**
76 * Get assets
77 *
78 * @return \Doctrine\Common\Collections\Collection
79 */
80 public function getAssets(): Collection {
81 return $this->assets;
82 }
83 }