1 <?php 
declare(strict_types
=1); 
   4  * This file is part of the Rapsys BlogBundle package. 
   6  * (c) Raphaël Gertz <symfony@rapsys.eu> 
   8  * For the full copyright and license information, please view the LICENSE 
   9  * file that was distributed with this source code. 
  12 namespace Rapsys\BlogBundle\Entity
; 
  14 use Doctrine\Common\Collections\Collection
; 
  15 use Doctrine\Common\Collections\ArrayCollection
; 
  17 use Rapsys\UserBundle\Entity\User 
as BaseUser
; 
  19 class User 
extends BaseUser 
{ 
  23         protected ?string $pseudonym; 
  28         protected ?string $slug; 
  31          * @var \Doctrine\Common\Collections\Collection 
  33         private Collection 
$articles; 
  36          * @var \Doctrine\Common\Collections\Collection 
  38         private Collection 
$user_translations; 
  43          * @param string $mail The user mail 
  44          * @param string $password The user password 
  45          * @param ?Civility $civility The user civility 
  46          * @param ?string $forename The user forename 
  47          * @param ?string $surname The user surname 
  48          * @param bool $active The user active 
  49          * @param bool $disabled The user disabled 
  50          * @param ?string $pseudonym The user pseudonym 
  51          * @param ?string $slug The user slug 
  53         public function __construct(string $mail, string $password, ?Civility 
$civility = null, ?string $forename = null, ?string $surname = null, bool $active = false, bool $disabled = false, ?string $pseudonym = null, ?string $slug = null) { 
  54                 //Call parent constructor 
  55                 parent
::__construct($mail, $password, $civility, $forename, $surname, $active, $disabled); 
  58                 $this->pseudonym 
= $pseudonym; 
  62                 $this->articles 
= new ArrayCollection(); 
  63                 $this->user_translations 
= new ArrayCollection(); 
  69          * @param ?string $pseudonym 
  73         public function setPseudonym(?string $pseudonym = null): User 
{ 
  74                 $this->pseudonym 
= $pseudonym; 
  84         public function getPseudonym(): ?string { 
  85                 return $this->pseudonym
; 
  91          * @param ?string $slug 
  95         public function setSlug(?string $slug = null): User 
{ 
 106         public function getSlug(): ?string { 
 113          * @param Article $article 
 117         public function addArticle(Article 
$article): User 
{ 
 118                 $this->articles
[] = $article; 
 126          * @param Article $article 
 128          * @return \Doctrine\Common\Collections\Collection 
 130         public function removeArticle(Article 
$article): Collection 
{ 
 131                 return $this->articles
->removeElement($article); 
 137          * @return \Doctrine\Common\Collections\Collection 
 139         public function getArticles(): Collection 
{ 
 140                 return $this->articles
; 
 144          * Add user translation 
 146          * @param \Rapsys\BlogBundle\Entity\UserTranslation $userTranslation 
 150         public function addUserTranslation(UserTranslation 
$userTranslation): User 
{ 
 151                 $this->user_translations
[] = $userTranslation; 
 157          * Remove user translation 
 159          * @param \Rapsys\BlogBundle\Entity\UserTranslation $userTranslation 
 161          * @return \Doctrine\Common\Collections\Collection 
 163         public function removeUserTranslation(UserTranslation 
$userTranslation): Collection 
{ 
 164                 return $this->user_translations
->removeElement($userTranslation); 
 168          * Get user translations 
 170          * @return \Doctrine\Common\Collections\Collection 
 172         public function getUserTranslations(): Collection 
{ 
 173                 return $this->user_translations
;