* * 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 $assets; /** * 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->assets = new ArrayCollection(); } /** * Add asset * * @param Asset $asset * * @return User */ public function addAsset(Asset $asset): User { $this->assets[] = $asset; return $this; } /** * Remove asset * * @param Asset $asset * * @return \Doctrine\Common\Collections\Collection */ public function removeAsset(Asset $asset): Collection { return $this->assets->removeElement($asset); } /** * Get assets * * @return \Doctrine\Common\Collections\Collection */ public function getAssets(): Collection { return $this->assets; } }