* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Rapsys\TreeBundle\Entity; use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\ArrayCollection; use Rapsys\UserBundle\Entity\User as BaseUser; /** * {@inheritdoc} */ class User extends BaseUser { /** * @var \Doctrine\Common\Collections\Collection */ private Collection $resources; /** * Constructor * * @param string $mail The user mail * @param string $password The user password * @param ?Civility $civility The user civility * @param ?string $forename The user forename * @param ?string $surname The user surname * @param bool $active The user is active * @param bool $enable The user is enable * @param ?string $pseudonym The user pseudonym * @param ?string $slug The user slug */ 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) { //Call parent constructor parent::__construct($mail, $password, $civility, $forename, $surname, $active, $enable); //Set defaults //Set collections $this->resources = new ArrayCollection(); } /** * Add resource * * @param Resource $resource * * @return User */ public function addResource(Resource $resource): User { $this->resources[] = $resource; return $this; } /** * Remove resource * * @param Resource $resource * * @return \Doctrine\Common\Collections\Collection */ public function removeResource(Resource $resource): Collection { return $this->resources->removeElement($resource); } /** * Get resources * * @return \Doctrine\Common\Collections\Collection */ public function getResources(): Collection { return $this->resources; } }