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