X-Git-Url: https://git.rapsys.eu/.gitweb.cgi/treebundle/blobdiff_plain/85da4296f5f945c4db6d552048ed7423eadb6f02..bc23d7a89281c97e385b252c02de5f117f72b5a3:/Entity/User.php diff --git a/Entity/User.php b/Entity/User.php new file mode 100644 index 0000000..b0a143e --- /dev/null +++ b/Entity/User.php @@ -0,0 +1,83 @@ + + * + * 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; + } +}