src/Entity/User.php line 24

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use FOS\UserBundle\Model\User as BaseUser;
  6. use DateTimeInterface;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  9. use Symfony\Component\HttpFoundation\File\File;
  10. use Symfony\Component\Validator\Constraints as Assert;
  11. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  12. use App\Repository\UserRepository;
  13. /**
  14.  * @ORM\Entity
  15.  * @ORM\Entity(repositoryClass=UserRepository::class)
  16.  * @UniqueEntity("fakeFullName")
  17.  * @ORM\Table(name="fos_user")
  18.  * @ORM\HasLifecycleCallbacks
  19.  * @Vich\Uploadable()
  20.  */
  21. class User extends BaseUser
  22. {
  23.     const GENDER = [
  24.         'unknown' => 0,
  25.         'female'  => 1,
  26.         'male'    => 2
  27.     ];
  28.     const THEME = [
  29.         "white" => 0,
  30.         "dark" => 1
  31.     ];
  32.     /**
  33.      * Roles
  34.      */
  35.     const ROLE_ADMIN 'ROLE_ADMIN';
  36.     const ROLE_SHOP_MANAGER 'ROLE_SHOP_MANAGER';
  37.     /******************** BEGIN Summary ********************/
  38.     /**
  39.      * @ORM\Id
  40.      * @ORM\Column(type="integer")
  41.      * @ORM\GeneratedValue(strategy="AUTO")
  42.      */
  43.     protected $id;
  44.     /**
  45.      * @ORM\Column(type="smallint", options={"default": 0})
  46.      */
  47.     private $gender 0;
  48.     /**
  49.      * @ORM\Column(type="smallint", nullable=true)
  50.      */
  51.     private $theme;
  52.     /**
  53.      * @ORM\Column(type="string", length=64, nullable=true)
  54.      */
  55.     private $firstname;
  56.     /**
  57.      * @ORM\Column(type="string", length=64, nullable=true)
  58.      */
  59.     private $lastname;
  60.     /**
  61.      * @ORM\Column(type="datetime", nullable=true)
  62.      */
  63.     private $birthday;
  64.     /**
  65.      * @ORM\Column(type="string", length=50, nullable=true)
  66.      */
  67.     private $city;
  68.     /**
  69.      * @ORM\Column(type="string", length=64, nullable=true)
  70.      */
  71.     private $phone;
  72.     /**
  73.      * @ORM\Column(type="string", nullable=true)
  74.      */
  75.     private $facebookProfileLink;
  76.     /**
  77.      * @ORM\Column(name="avatar", type="string", nullable=true, options={"comment": "Avatar file path"})
  78.      */
  79.     private $avatar;
  80.     /**
  81.      * @Vich\UploadableField(mapping="user_avatar", fileNameProperty="avatar")
  82.      * @Assert\File(maxSize="4194304")
  83.      * @Assert\Image()
  84.      */
  85.     private $avatarFile;
  86.     /**
  87.      * @ORM\Column(type="text", nullable=true)
  88.      */
  89.     public $deliveryAddress;
  90.     /**
  91.      * @ORM\Column(type="string", nullable=true, unique=true)
  92.      */
  93.     private $fakeFullName;
  94.     /**
  95.      * @ORM\Column(type="string", nullable=true)
  96.      */
  97.     private $fakeAvatar;
  98.     /**
  99.      * @ORM\Column(type="boolean", options={"default" : false})
  100.      */
  101.     private $deleted false;
  102.     /**
  103.      * @ORM\Column(type="boolean", options={"default" : false})
  104.      */
  105.     private $policyAgreement false;
  106.     /**
  107.      * @ORM\Column(type="datetime", nullable=true)
  108.      */
  109.     private $registrationDate;
  110.     /**
  111.      * @ORM\Column(type="datetime", nullable=true)
  112.      */
  113.     private $updatedAt;
  114.     /**
  115.      * @ORM\Column(type="integer", options={"default": 0})
  116.      */
  117.     private $currentBalance 0;
  118.     /**
  119.      * @ORM\Column(type="json_array", options={"jsonb"=true}, nullable=true)
  120.      */
  121.     private $appSettings = [];
  122.     /******************** END Summary **********************/
  123.     /******************** BEGIN Relations ******************/
  124.     /**
  125.      * @ORM\OneToMany(targetEntity="App\Entity\UserToken", mappedBy="user", orphanRemoval=true)
  126.      */
  127.     private $userTokens;
  128.     /**
  129.      * @ORM\OneToMany(targetEntity="App\Entity\ShopOrder", mappedBy="user")
  130.      */
  131.     private $shopOrders;
  132.     /**
  133.      * @ORM\OneToMany(targetEntity="App\Entity\Resource", mappedBy="user")
  134.      */
  135.     private $resources;
  136.     /**
  137.      * @ORM\OneToMany(targetEntity="App\Entity\MessageLog", mappedBy="user")
  138.      */
  139.     private $messageLogs;
  140.     /**
  141.      * @ORM\OneToMany(targetEntity="App\Entity\Permission", mappedBy="user")
  142.      */
  143.     private $permissions;
  144.     /**
  145.      * @ORM\OneToMany(targetEntity=PermissionShop::class, mappedBy="user")
  146.      */
  147.     private $permissionShops;
  148.     /**
  149.      * @ORM\Column(type="string", length=255, nullable=true)
  150.      */
  151.     private $country;
  152.     /**
  153.      * @ORM\ManyToMany(targetEntity=Shop::class, mappedBy="shopManagerUsers")
  154.      */
  155.     private $managedShops;
  156.     /**
  157.      * @ORM\OneToMany(targetEntity=FAQ::class, mappedBy="userAuthor")
  158.      */
  159.     private $fAQs;
  160.     /**
  161.      * @ORM\OneToMany(targetEntity=Article::class, mappedBy="userAuthor")
  162.      */
  163.     private $articles;
  164.     /**
  165.      * @ORM\OneToMany(targetEntity=Pricing::class, mappedBy="author_user")
  166.      */
  167.     private $pricings;
  168.     /**
  169.      * @ORM\OneToMany(targetEntity=Page::class, mappedBy="author_user")
  170.      */
  171.     private $pages;
  172.     /**
  173.      * @ORM\OneToMany(targetEntity=Landing::class, mappedBy="author_user")
  174.      */
  175.     private $landings;
  176.     /**
  177.      * @ORM\OneToMany(targetEntity=UserScoreLog::class, mappedBy="user")
  178.      */
  179.     private $userScoreLogs;
  180.     /**
  181.      * @ORM\OneToMany(targetEntity=UserActionLog::class, mappedBy="user_id")
  182.      */
  183.     private $userActionLogs;
  184.     /**
  185.      * @ORM\OneToMany(targetEntity=Game::class, mappedBy="user")
  186.      */
  187.     private $games;
  188.     /**
  189.      * @ORM\OneToMany(targetEntity="App\Entity\UserArticleBookmark", mappedBy="user")
  190.      */
  191.     private $userArticleBookmarks;
  192.     /**
  193.      * @ORM\OneToMany(targetEntity="App\Entity\UserProductBookmark", mappedBy="user")
  194.      */
  195.     private $userProductBookmarks;
  196.     /**
  197.      * @ORM\ManyToOne(targetEntity=Language::class, inversedBy="users")
  198.      * @ORM\JoinColumn(name="selected_language_id", referencedColumnName="id", onDelete="SET NULL")
  199.      */
  200.     private $selected_language;
  201.     /******************** END Relations ********************/
  202.     public function __construct()
  203.     {
  204.         parent::__construct();
  205.         $this->userTokens             = new ArrayCollection();
  206.         $this->shopOrders             = new ArrayCollection();
  207.         $this->resources              = new ArrayCollection();
  208.         $this->messageLogs            = new ArrayCollection();
  209.         $this->permissions            = new ArrayCollection();
  210.         $this->permissionShops = new ArrayCollection();
  211.         $this->fAQs = new ArrayCollection();
  212.         $this->managedShops = new ArrayCollection();
  213.         $this->articles = new ArrayCollection();
  214.         $this->pricings = new ArrayCollection();
  215.         $this->pages = new ArrayCollection();
  216.         $this->landings = new ArrayCollection();
  217.         $this->userScoreLogs = new ArrayCollection();
  218.         $this->userActionLogs = new ArrayCollection();
  219.         $this->userArticleBookmarks = new ArrayCollection();
  220.         $this->userProductBookmarks = new ArrayCollection();
  221.         $this->games = new ArrayCollection();
  222.     }
  223.     /******************** BEGIN Getters and Setters ********************/
  224.     /**
  225.      * @return int
  226.      */
  227.     public function getId(): int
  228.     {
  229.         return $this->id;
  230.     }
  231.     /**
  232.      * @return int
  233.      */
  234.     public function getGender(): int
  235.     {
  236.         return $this->gender;
  237.     }
  238.     /**
  239.      * @param int $gender
  240.      * @return User
  241.      */
  242.     public function setGender($gender): self
  243.     {
  244.         $this->gender $gender;
  245.         return $this;
  246.     }
  247.     /**
  248.      * @return string|null
  249.      */
  250.     public function getTheme(): ?string
  251.     {
  252.         return $this->theme;
  253.     }
  254.     /**
  255.      * @param $theme
  256.      * @return User
  257.      */
  258.     public function setTheme($theme): self
  259.     {
  260.         $this->theme $theme;
  261.         return $this;
  262.     }
  263.     /**
  264.      * @return array
  265.      */
  266.     public function getAppSettings(): array
  267.     {
  268.         return $this->appSettings;
  269.     }
  270.     /**
  271.      * @param array $appSettings
  272.      * @return User
  273.      */
  274.     public function setAppSettings(array $appSettings): self
  275.     {
  276.         $this->appSettings $appSettings;
  277.         return $this;
  278.     }
  279.     /**
  280.      * @return string
  281.      */
  282.     public function getStringGender()
  283.     {
  284.         return array_flip(self::GENDER)[$this->getGender()] ?? "undefined";
  285.     }
  286.     /**
  287.      * @return array
  288.      */
  289.     public function getGenderList(): array
  290.     {
  291.         return array_keys(self::GENDER);
  292.     }
  293.     /**
  294.      * @return string
  295.      */
  296.     public function getStringTheme(): string
  297.     {
  298.         return array_flip(self::THEME)[$this->getTheme()] ?? "undefined";
  299.     }
  300.     /**
  301.      * @return array
  302.      */
  303.     public function getThemeList(): array
  304.     {
  305.         return array_keys(self::THEME);
  306.     }
  307.     /**
  308.      * @return string|null
  309.      */
  310.     public function getFirstname(): ?string
  311.     {
  312.         return $this->firstname;
  313.     }
  314.     /**
  315.      * @param string|null $firstname
  316.      * @return User
  317.      */
  318.     public function setFirstname($firstname): self
  319.     {
  320.         $this->firstname $firstname;
  321.         return $this;
  322.     }
  323.     /**
  324.      * @return string|null
  325.      */
  326.     public function getLastname(): ?string
  327.     {
  328.         return $this->lastname;
  329.     }
  330.     /**
  331.      * @param string|null $lastname
  332.      * @return User
  333.      */
  334.     public function setLastname($lastname): self
  335.     {
  336.         $this->lastname $lastname;
  337.         return $this;
  338.     }
  339.     /**
  340.      * @return DateTimeInterface|null
  341.      */
  342.     public function getBirthday(): ?DateTimeInterface
  343.     {
  344.         return $this->birthday;
  345.     }
  346.     /**
  347.      * @param DateTimeInterface|null $birthday
  348.      * @return User
  349.      */
  350.     public function setBirthday($birthday): self
  351.     {
  352.         $this->birthday $birthday;
  353.         return $this;
  354.     }
  355.     /**
  356.      * @return string|null
  357.      */
  358.     public function getCity(): ?string
  359.     {
  360.         return $this->city;
  361.     }
  362.     /**
  363.      * @param string|null $city
  364.      * @return User
  365.      */
  366.     public function setCity($city): self
  367.     {
  368.         $this->city $city;
  369.         return $this;
  370.     }
  371.     /**
  372.      * @return string|null
  373.      */
  374.     public function getPhone(): ?string
  375.     {
  376.         return $this->phone;
  377.     }
  378.     /**
  379.      * @param string|null $phone
  380.      * @return User
  381.      */
  382.     public function setPhone($phone): self
  383.     {
  384.         $this->phone $phone;
  385.         return $this;
  386.     }
  387.     /**
  388.      * @return string|null
  389.      */
  390.     public function getFacebookProfileLink(): ?string
  391.     {
  392.         return $this->facebookProfileLink;
  393.     }
  394.     /**
  395.      * @param string|null $facebookProfileLink
  396.      * @return User
  397.      */
  398.     public function setFacebookProfileLink($facebookProfileLink): self
  399.     {
  400.         $this->facebookProfileLink $facebookProfileLink;
  401.         return $this;
  402.     }
  403.     /**
  404.      * @return string|null
  405.      */
  406.     public function getInstagramProfileLink(): ?string
  407.     {
  408.         return $this->instagramProfileLink;
  409.     }
  410.     /**
  411.      * @param string|null $instagramProfileLink
  412.      * @return User
  413.      */
  414.     public function setInstagramProfileLink($instagramProfileLink): self
  415.     {
  416.         $this->instagramProfileLink $instagramProfileLink;
  417.         return $this;
  418.     }
  419.     /**
  420.      * @return string|null
  421.      */
  422.     public function getAvatar(): ?string
  423.     {
  424.         return $this->avatar;
  425.     }
  426.     /**
  427.      * @param string $avatar
  428.      * @return User
  429.      */
  430.     public function setAvatar($avatar): self
  431.     {
  432.         $this->avatar $avatar;
  433.         return $this;
  434.     }
  435.     /**
  436.      * @return File
  437.      */
  438.     public function getAvatarFile(): ?File
  439.     {
  440.         return $this->avatarFile;
  441.     }
  442.     /**
  443.      * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile $file
  444.      * @throws \Exception
  445.      */
  446.     public function setAvatarFile(File $file null)
  447.     {
  448.         $this->avatarFile $file;
  449.         if (null !== $file) {
  450.             $this->updatedAt = new \DateTime();
  451.         }
  452.     }
  453.     /**
  454.      * @return string|null
  455.      */
  456.     public function getAvatarUrl(): ?string
  457.     {
  458.         return $this->avatar '/uploads/files/user/' $this->avatar null;
  459.     }
  460.     /**
  461.      * @return string|null
  462.      */
  463.     public function getDeliveryAddress(): ?string
  464.     {
  465.         return $this->deliveryAddress;
  466.     }
  467.     /**
  468.      * @param string|null $deliveryAddress
  469.      * @return User
  470.      */
  471.     public function setDeliveryAddress($deliveryAddress): self
  472.     {
  473.         $this->deliveryAddress $deliveryAddress;
  474.         return $this;
  475.     }
  476.     /**
  477.      * @return bool
  478.      */
  479.     public function isPress(): bool
  480.     {
  481.         return $this->press;
  482.     }
  483.     /**
  484.      * @param bool $press
  485.      * @return User
  486.      */
  487.     public function setPress($press): self
  488.     {
  489.         $this->press $press;
  490.         return $this;
  491.     }
  492.     /**
  493.      * @return string
  494.      */
  495.     public function getPressResourceName(): ?string
  496.     {
  497.         return $this->pressResourceName;
  498.     }
  499.     /**
  500.      * @param string $pressResourceName
  501.      * @return User
  502.      */
  503.     public function setPressResourceName($pressResourceName): self
  504.     {
  505.         $this->pressResourceName $pressResourceName;
  506.         return $this;
  507.     }
  508.     /**
  509.      * @return bool
  510.      */
  511.     public function isHiddenIdentity(): bool
  512.     {
  513.         return $this->hiddenIdentity;
  514.     }
  515.     /**
  516.      * @param bool $hiddenIdentity
  517.      * @return User
  518.      */
  519.     public function setHiddenIdentity($hiddenIdentity): self
  520.     {
  521.         $this->hiddenIdentity $hiddenIdentity;
  522.         return $this;
  523.     }
  524.     /**
  525.      * @return string|null
  526.      */
  527.     public function getFakeFullName()
  528.     {
  529.         return $this->fakeFullName;
  530.     }
  531.     /**
  532.      * @param string|null $fakeFullName
  533.      * @return User
  534.      */
  535.     public function setFakeFullName($fakeFullName): self
  536.     {
  537.         $this->fakeFullName $fakeFullName;
  538.         return $this;
  539.     }
  540.     /**
  541.      * @return string|null
  542.      */
  543.     public function getFakeAvatar()
  544.     {
  545.         return $this->fakeAvatar;
  546.     }
  547.     /**
  548.      * @param string|null $fakeAvatar
  549.      * @return User
  550.      */
  551.     public function setFakeAvatar($fakeAvatar): self
  552.     {
  553.         $this->fakeAvatar $fakeAvatar;
  554.         return $this;
  555.     }
  556.     /**
  557.      * @return bool
  558.      */
  559.     public function isDeleted(): bool
  560.     {
  561.         return $this->deleted;
  562.     }
  563.     /**
  564.      * @param bool $deleted
  565.      * @return User
  566.      */
  567.     public function setDeleted($deleted): self
  568.     {
  569.         $this->deleted $deleted;
  570.         return $this;
  571.     }
  572.     /**
  573.      * @return bool
  574.      */
  575.     public function getPolicyAgreement(): bool
  576.     {
  577.         return $this->policyAgreement;
  578.     }
  579.     /**
  580.      * @param bool $policyAgreement
  581.      * @return User
  582.      */
  583.     public function setPolicyAgreement($policyAgreement): self
  584.     {
  585.         $this->policyAgreement $policyAgreement;
  586.         return $this;
  587.     }
  588.     /**
  589.      * @return DateTimeInterface|null
  590.      */
  591.     public function getRegistrationDate(): ?DateTimeInterface
  592.     {
  593.         return $this->registrationDate;
  594.     }
  595.     /**
  596.      * @param DateTimeInterface $registrationDate
  597.      * @return User
  598.      */
  599.     public function setRegistrationDate($registrationDate): self
  600.     {
  601.         $this->registrationDate $registrationDate;
  602.         return $this;
  603.     }
  604.     /**
  605.      * @return \DateTimeInterface|null
  606.      */
  607.     public function getUpdatedAt(): ?\DateTimeInterface
  608.     {
  609.         return $this->updatedAt;
  610.     }
  611.     /**
  612.      * @return integer
  613.      */
  614.     public function getCurrentBalance(): int
  615.     {
  616.         return $this->currentBalance;
  617.     }
  618.     /**
  619.      * @param integer $currentBalance
  620.      * @return User
  621.      */
  622.     public function setCurrentBalance($currentBalance): self
  623.     {
  624.         $this->currentBalance $currentBalance;
  625.         return $this;
  626.     }
  627.     /**
  628.      * @return Collection|ShopOrder[]
  629.      */
  630.     public function getShopOrders(): Collection
  631.     {
  632.         return $this->shopOrders;
  633.     }
  634.     /**
  635.      * @return Collection|Resource[]
  636.      */
  637.     public function getResources(): Collection
  638.     {
  639.         return $this->resources;
  640.     }
  641.     /**
  642.      * @return Collection|MessageLog[]
  643.      */
  644.     public function getMessageLogs(): Collection
  645.     {
  646.         return $this->messageLogs;
  647.     }
  648.     /**
  649.      * @return Collection|Permission[]
  650.      */
  651.     public function getPermissions(): Collection
  652.     {
  653.         return $this->permissions;
  654.     }
  655.     /**
  656.      * @return Collection|UserToken[]
  657.      */
  658.     public function getUserTokens(): Collection
  659.     {
  660.         return $this->userTokens;
  661.     }
  662.     /**
  663.      * @param UserToken $userToken
  664.      * @return User
  665.      */
  666.     public function addUserToken(UserToken $userToken): self
  667.     {
  668.         if (!$this->userTokens->contains($userToken)) {
  669.             $this->userTokens[] = $userToken;
  670.             $userToken->setUser($this);
  671.         }
  672.         return $this;
  673.     }
  674.     /**
  675.      * @param UserToken $userToken
  676.      * @return User
  677.      */
  678.     public function removeUserToken(UserToken $userToken): self
  679.     {
  680.         if ($this->userTokens->contains($userToken)) {
  681.             $this->userTokens->removeElement($userToken);
  682.             // set the owning side to null (unless already changed)
  683.             if ($userToken->getUser() === $this) {
  684.                 $userToken->setUser(null);
  685.             }
  686.         }
  687.         return $this;
  688.     }
  689.     /******************** END Getters and Setters ********************/
  690.     /**
  691.      * @return bool
  692.      */
  693.     public function isAdmin()
  694.     {
  695.         return $this->hasRole(self::ROLE_ADMIN);
  696.     }
  697.     /**
  698.      * @return bool
  699.      */
  700.     public function isShopManager()
  701.     {
  702.         return $this->hasRole(self::ROLE_SHOP_MANAGER);
  703.     }
  704. //    /**
  705. //     * @return bool
  706. //     */
  707. //    public function isImplementor()
  708. //    {
  709. //        return $this->hasRole(self::ROLE_IMPLEMENTOR);
  710. //    }
  711.     /**
  712.      * @ORM\PrePersist
  713.      *
  714.      * @throws \Exception
  715.      */
  716.     public function onPrePersist()
  717.     {
  718.         $this->registrationDate = new \DateTime('now');
  719.     }
  720.     /**
  721.      * @ORM\PreUpdate
  722.      *
  723.      * @throws \Exception
  724.      */
  725.     public function onPreUpdate()
  726.     {
  727.         $this->updatedAt = new \DateTime('now');
  728.     }
  729.     /**
  730.      * @return bool|null
  731.      */
  732.     public function getPress(): ?bool
  733.     {
  734.         return $this->press;
  735.     }
  736.     /**
  737.      * @return bool|null
  738.      */
  739.     public function getDeleted(): ?bool
  740.     {
  741.         return $this->deleted;
  742.     }
  743.     /**
  744.      * @param DateTimeInterface|null $updatedAt
  745.      * @return $this
  746.      */
  747.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  748.     {
  749.         $this->updatedAt $updatedAt;
  750.         return $this;
  751.     }
  752.     /**
  753.      * @param ShopOrder $shopOrder
  754.      * @return $this
  755.      */
  756.     public function addShopOrder(ShopOrder $shopOrder): self
  757.     {
  758.         if (!$this->shopOrders->contains($shopOrder)) {
  759.             $this->shopOrders[] = $shopOrder;
  760.             $shopOrder->setUser($this);
  761.         }
  762.         return $this;
  763.     }
  764.     /**
  765.      * @param ShopOrder $shopOrder
  766.      * @return $this
  767.      */
  768.     public function removeShopOrder(ShopOrder $shopOrder): self
  769.     {
  770.         if ($this->shopOrders->contains($shopOrder)) {
  771.             $this->shopOrders->removeElement($shopOrder);
  772.             // set the owning side to null (unless already changed)
  773.             if ($shopOrder->getUser() === $this) {
  774.                 $shopOrder->setUser(null);
  775.             }
  776.         }
  777.         return $this;
  778.     }
  779.     /**
  780.      * @return bool|null
  781.      */
  782.     public function getHiddenIdentity(): ?bool
  783.     {
  784.         return $this->hiddenIdentity;
  785.     }
  786.     /**
  787.      * @param Permission $permission
  788.      * @return $this
  789.      */
  790.     public function addPermission(Permission $permission): self
  791.     {
  792.         if (!$this->permissions->contains($permission)) {
  793.             $this->permissions[] = $permission;
  794.             $permission->setUser($this);
  795.         }
  796.         return $this;
  797.     }
  798.     /**
  799.      * @param Permission $permission
  800.      * @return $this
  801.      */
  802.     public function removePermission(Permission $permission): self
  803.     {
  804.         if ($this->permissions->contains($permission)) {
  805.             $this->permissions->removeElement($permission);
  806.             // set the owning side to null (unless already changed)
  807.             if ($permission->getUser() === $this) {
  808.                 $permission->setUser(null);
  809.             }
  810.         }
  811.         return $this;
  812.     }
  813.     /**
  814.      * @return Collection|PermissionShop[]
  815.      */
  816.     public function getPermissionShops(): Collection
  817.     {
  818.         return $this->permissionShops;
  819.     }
  820.     /**
  821.      * @param PermissionShop $permissionShop
  822.      * @return $this
  823.      */
  824.     public function addPermissionShop(PermissionShop $permissionShop): self
  825.     {
  826.         if (!$this->permissionShops->contains($permissionShop)) {
  827.             $this->permissionShops[] = $permissionShop;
  828.             $permissionShop->setUser($this);
  829.         }
  830.         return $this;
  831.     }
  832.     /**
  833.      * @param PermissionShop $permissionShop
  834.      * @return $this
  835.      */
  836.     public function removePermissionShop(PermissionShop $permissionShop): self
  837.     {
  838.         if ($this->permissionShops->contains($permissionShop)) {
  839.             $this->permissionShops->removeElement($permissionShop);
  840.             // set the owning side to null (unless already changed)
  841.             if ($permissionShop->getUser() === $this) {
  842.                 $permissionShop->setUser(null);
  843.             }
  844.         }
  845.         return $this;
  846.     }
  847.     /**
  848.      * @return string|null
  849.      */
  850.     public function getCountry(): ?string
  851.     {
  852.         return $this->country;
  853.     }
  854.     /**
  855.      * @param string|null $country
  856.      * @return $this
  857.      */
  858.     public function setCountry(?string $country): self
  859.     {
  860.         $this->country $country;
  861.         return $this;
  862.     }
  863.     /**
  864.      * @return Collection|Shop[]
  865.      */
  866.     public function getManagedShops(): Collection
  867.     {
  868.         return $this->managedShops;
  869.     }
  870.     /**
  871.      * @param Shop $managedShop
  872.      * @return $this
  873.      */
  874.     public function addManagedShop(Shop $managedShop): self
  875.     {
  876.         if (!$this->managedShops->contains($managedShop)) {
  877.             $this->managedShops[] = $managedShop;
  878.             $managedShop->addShopManagerUser($this);
  879.         }
  880.         return $this;
  881.     }
  882.     /**
  883.      * @param Shop $managedShop
  884.      * @return $this
  885.      */
  886.     public function removeManagedShop(Shop $managedShop): self
  887.     {
  888.         if ($this->managedShops->contains($managedShop)) {
  889.             $this->managedShops->removeElement($managedShop);
  890.             $managedShop->removeShopManagerUser($this);
  891.         }
  892.         return $this;
  893.     }
  894.     /**
  895.      * @return Collection|FAQ[]
  896.      */
  897.     public function getFAQs(): Collection
  898.     {
  899.         return $this->fAQs;
  900.     }
  901.     /**
  902.      * @param FAQ $fAQ
  903.      * @return $this
  904.      */
  905.     public function addFAQ(FAQ $fAQ): self
  906.     {
  907.         if (!$this->fAQs->contains($fAQ)) {
  908.             $this->fAQs[] = $fAQ;
  909.             $fAQ->setUserAuthor($this);
  910.         }
  911.         return $this;
  912.     }
  913.     /**
  914.      * @param FAQ $fAQ
  915.      * @return $this
  916.      */
  917.     public function removeFAQ(FAQ $fAQ): self
  918.     {
  919.         if ($this->fAQs->contains($fAQ)) {
  920.             $this->fAQs->removeElement($fAQ);
  921.             // set the owning side to null (unless already changed)
  922.             if ($fAQ->getUserAuthor() === $this) {
  923.                 $fAQ->setUserAuthor(null);
  924.             }
  925.         }
  926.         return $this;
  927.     }
  928.     /**
  929.      * @return Collection|Article[]
  930.      */
  931.     public function getArticles(): Collection
  932.     {
  933.         return $this->articles;
  934.     }
  935.     /**
  936.      * @param Article $article
  937.      * @return $this
  938.      */
  939.     public function addArticle(Article $article): self
  940.     {
  941.         if (!$this->articles->contains($article)) {
  942.             $this->articles[] = $article;
  943.             $article->setUserAuthor($this);
  944.         }
  945.         return $this;
  946.     }
  947.     /**
  948.      * @param Article $article
  949.      * @return $this
  950.      */
  951.     public function removeArticle(Article $article): self
  952.     {
  953.         if ($this->articles->contains($article)) {
  954.             $this->articles->removeElement($article);
  955.             // set the owning side to null (unless already changed)
  956.             if ($article->getUserAuthor() === $this) {
  957.                 $article->setUserAuthor(null);
  958.             }
  959.         }
  960.         return $this;
  961.     }
  962.     /**
  963.      * @return Collection
  964.      */
  965.     public function getPricing(): Collection
  966.     {
  967.         return $this->pricings;
  968.     }
  969.     /**
  970.      * @param Pricing $pricing
  971.      * @return $this
  972.      */
  973.     public function addPricing(Pricing $pricing): self
  974.     {
  975.         if (!$this->pricings->contains($pricing)) {
  976.             $this->pricings[] = $pricing;
  977.             $pricing->setUserAuthor($this);
  978.         }
  979.         return $this;
  980.     }
  981.     /**
  982.      * @param Pricing $pricing
  983.      * @return $this
  984.      */
  985.     public function removePricing(Pricing $pricing): self
  986.     {
  987.         if ($this->pricings->contains($pricing)) {
  988.             $this->pricings->removeElement($pricing);
  989.             // set the owning side to null (unless already changed)
  990.             if ($pricing->getUserAuthor() === $this) {
  991.                 $pricing->setUserAuthor(null);
  992.             }
  993.         }
  994.         return $this;
  995.     }
  996.     /**
  997.      * @return Collection|Page[]
  998.      */
  999.     public function getPages(): Collection
  1000.     {
  1001.         return $this->pages;
  1002.     }
  1003.     /**
  1004.      * @param Page $page
  1005.      * @return $this
  1006.      */
  1007.     public function addPage(Page $page): self
  1008.     {
  1009.         if (!$this->pages->contains($page)) {
  1010.             $this->pages[] = $page;
  1011.             $page->setAuthorUser($this);
  1012.         }
  1013.         return $this;
  1014.     }
  1015.     /**
  1016.      * @param Page $page
  1017.      * @return $this
  1018.      */
  1019.     public function removePage(Page $page): self
  1020.     {
  1021.         if ($this->pages->contains($page)) {
  1022.             $this->pages->removeElement($page);
  1023.             // set the owning side to null (unless already changed)
  1024.             if ($page->getAuthorUser() === $this) {
  1025.                 $page->setAuthorUser(null);
  1026.             }
  1027.         }
  1028.         return $this;
  1029.     }
  1030.     /**
  1031.      * @param Resource $resource
  1032.      * @return User
  1033.      */
  1034.     public function addResource(Resource $resource): self
  1035.     {
  1036.         if (!$this->resources->contains($resource)) {
  1037.             $this->resources[] = $resource;
  1038.             $resource->setUser($this);
  1039.         }
  1040.         return $this;
  1041.     }
  1042.     /**
  1043.      * @param Resource $resource
  1044.      * @return User
  1045.      */
  1046.     public function removeResource(Resource $resource): self
  1047.     {
  1048.         if ($this->resources->contains($resource)) {
  1049.             $this->resources->removeElement($resource);
  1050.             // set the owning side to null (unless already changed)
  1051.             if ($resource->getUser() === $this) {
  1052.                 $resource->setUser(null);
  1053.             }
  1054.         }
  1055.         return $this;
  1056.     }
  1057.     /*
  1058.      * @return Collection|Landing[]
  1059.      */
  1060.     public function getLandings(): Collection
  1061.     {
  1062.         return $this->landings;
  1063.     }
  1064.     public function addLanding(Landing $landing): self
  1065.     {
  1066.         if (!$this->landings->contains($landing)) {
  1067.             $this->landings[] = $landing;
  1068.             $landing->setAuthorUser($this);
  1069.         }
  1070.         return $this;
  1071.     }
  1072.     /**
  1073.      * @param MessageLog $messageLog
  1074.      * @return User
  1075.      */
  1076.     public function addMessageLog(MessageLog $messageLog): self
  1077.     {
  1078.         if (!$this->messageLogs->contains($messageLog)) {
  1079.             $this->messageLogs[] = $messageLog;
  1080.             $messageLog->setUser($this);
  1081.         }
  1082.         return $this;
  1083.     }
  1084.     public function removeLanding(Landing $landing): self
  1085.     {
  1086.         if ($this->landings->contains($landing)) {
  1087.             $this->landings->removeElement($landing);
  1088.             // set the owning side to null (unless already changed)
  1089.             if ($landing->getAuthorUser() === $this) {
  1090.                 $landing->setAuthorUser(null);
  1091.             }
  1092.         }
  1093.         return $this;
  1094.     }
  1095.     /**
  1096.      * @param MessageLog $messageLog
  1097.      * @return User
  1098.      */
  1099.     public function removeMessageLog(MessageLog $messageLog): self
  1100.     {
  1101.         if ($this->messageLogs->contains($messageLog)) {
  1102.             $this->messageLogs->removeElement($messageLog);
  1103.             // set the owning side to null (unless already changed)
  1104.             if ($messageLog->getUser() === $this) {
  1105.                 $messageLog->setUser(null);
  1106.             }
  1107.         }
  1108.         return $this;
  1109.     }
  1110.     /*
  1111.      * @return Collection|UserScoreLog[]
  1112.      */
  1113.     public function getUserScoreLogs(): Collection
  1114.     {
  1115.         return $this->userScoreLogs;
  1116.     }
  1117.     public function addUserScoreLog(UserScoreLog $userScoreLog): self
  1118.     {
  1119.         if (!$this->userScoreLogs->contains($userScoreLog)) {
  1120.             $this->userScoreLogs[] = $userScoreLog;
  1121.             $userScoreLog->setUserId($this);
  1122.         }
  1123.         return $this;
  1124.     }
  1125.     public function removeUserScoreLog(UserScoreLog $userScoreLog): self
  1126.     {
  1127.         if ($this->userScoreLogs->contains($userScoreLog)) {
  1128.             $this->userScoreLogs->removeElement($userScoreLog);
  1129.             // set the owning side to null (unless already changed)
  1130.             if ($userScoreLog->getUserId() === $this) {
  1131.                 $userScoreLog->setUserId(null);
  1132.             }
  1133.         }
  1134.         return $this;
  1135.     }
  1136.     /**
  1137.      * @return Collection|UserActionLog[]
  1138.      */
  1139.     public function getUserActionLogs(): Collection
  1140.     {
  1141.         return $this->userActionLogs;
  1142.     }
  1143.     public function addUserActionLog(UserActionLog $userActionLog): self
  1144.     {
  1145.         if (!$this->userActionLogs->contains($userActionLog)) {
  1146.             $this->userActionLogs[] = $userActionLog;
  1147.             $userActionLog->setUserId($this);
  1148.         }
  1149.         return $this;
  1150.     }
  1151.     public function removeUserActionLog(UserActionLog $userActionLog): self
  1152.     {
  1153.         if ($this->userActionLogs->contains($userActionLog)) {
  1154.             $this->userActionLogs->removeElement($userActionLog);
  1155.             // set the owning side to null (unless already changed)
  1156.             if ($userActionLog->getUserId() === $this) {
  1157.                 $userActionLog->setUserId(null);
  1158.             }
  1159.         }
  1160.         return $this;
  1161.     }
  1162.     /**
  1163.      * @return Collection|Game[]
  1164.      */
  1165.     public function getGames(): Collection
  1166.     {
  1167.         return $this->games;
  1168.     }
  1169.     public function addGame(Game $game): self
  1170.     {
  1171.         if (!$this->games->contains($game)) {
  1172.             $this->games[] = $game;
  1173.             $game->setUser($this);
  1174.         }
  1175.         return $this;
  1176.     }
  1177.     public function removeGame(Game $game): self
  1178.     {
  1179.         if ($this->games->contains($game)) {
  1180.             $this->games->removeElement($game);
  1181.             // set the owning side to null (unless already changed)
  1182.             if ($game->getUser() === $this) {
  1183.                 $game->setUser(null);
  1184.             }
  1185.         }
  1186.         return $this;
  1187.     }
  1188.     /**
  1189.      * @return Collection|UserArticleBookmark[]
  1190.      */
  1191.     public function getUserArticleBookmarks(): Collection
  1192.     {
  1193.         return $this->userArticleBookmarks;
  1194.     }
  1195.     /**
  1196.      * @param UserArticleBookmark $userArticleBookmark
  1197.      * @return $this
  1198.      */
  1199.     public function addUserArticleBookmark(UserArticleBookmark $userArticleBookmark): self
  1200.     {
  1201.         if (!$this->userArticleBookmarks->contains($userArticleBookmark)) {
  1202.             $this->userArticleBookmarks[] = $userArticleBookmark;
  1203.             $userArticleBookmark->setUser($this);
  1204.         }
  1205.         return $this;
  1206.     }
  1207.     /**
  1208.      * @param UserArticleBookmark $userArticleBookmark
  1209.      * @return $this
  1210.      */
  1211.     public function removeUserArticleBookmark(UserArticleBookmark $userArticleBookmark): self
  1212.     {
  1213.         if ($this->userArticleBookmarks->contains($userArticleBookmark)) {
  1214.             $this->userArticleBookmarks->removeElement($userArticleBookmark);
  1215.             // set the owning side to null (unless already changed)
  1216.             if ($userArticleBookmark->getUser() === $this) {
  1217.                 $userArticleBookmark->setUser(null);
  1218.             }
  1219.         }
  1220.         return $this;
  1221.     }
  1222.     /**
  1223.      * @return Collection|UserProductBookmark[]
  1224.      */
  1225.     public function getUserProductBookmarks(): Collection
  1226.     {
  1227.         return $this->userProductBookmarks;
  1228.     }
  1229.     /**
  1230.      * @param UserProductBookmark $userProductBookmark
  1231.      * @return $this
  1232.      */
  1233.     public function addUserProductBookmark(UserProductBookmark $userProductBookmark): self
  1234.     {
  1235.         if (!$this->userProductBookmarks->contains($userProductBookmark)) {
  1236.             $this->userProductBookmarks[] = $userProductBookmark;
  1237.             $userProductBookmark->setUser($this);
  1238.         }
  1239.         return $this;
  1240.     }
  1241.     /**
  1242.      * @param UserProductBookmark $userProductBookmark
  1243.      * @return $this
  1244.      */
  1245.     public function removeUserProductBookmark(UserProductBookmark $userProductBookmark): self
  1246.     {
  1247.         if ($this->userProductBookmarks->contains($userProductBookmark)) {
  1248.             $this->userProductBookmarks->removeElement($userProductBookmark);
  1249.             // set the owning side to null (unless already changed)
  1250.             if ($userProductBookmark->getUser() === $this) {
  1251.                 $userProductBookmark->setUser(null);
  1252.             }
  1253.         }
  1254.         return $this;
  1255.     }
  1256.     public function getSelectedLanguage(): ?Language
  1257.     {
  1258.         return $this->selected_language;
  1259.     }
  1260.     public function setSelectedLanguage(?Language $selected_language): self
  1261.     {
  1262.         $this->selected_language $selected_language;
  1263.         return $this;
  1264.     }
  1265. }