<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use FOS\UserBundle\Model\User as BaseUser;
use DateTimeInterface;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\Validator\Constraints as Assert;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use App\Repository\UserRepository;
/**
* @ORM\Entity
* @ORM\Entity(repositoryClass=UserRepository::class)
* @UniqueEntity("fakeFullName")
* @ORM\Table(name="fos_user")
* @ORM\HasLifecycleCallbacks
* @Vich\Uploadable()
*/
class User extends BaseUser
{
const GENDER = [
'unknown' => 0,
'female' => 1,
'male' => 2
];
const THEME = [
"white" => 0,
"dark" => 1
];
/**
* Roles
*/
const ROLE_ADMIN = 'ROLE_ADMIN';
const ROLE_SHOP_MANAGER = 'ROLE_SHOP_MANAGER';
/******************** BEGIN Summary ********************/
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="smallint", options={"default": 0})
*/
private $gender = 0;
/**
* @ORM\Column(type="smallint", nullable=true)
*/
private $theme;
/**
* @ORM\Column(type="string", length=64, nullable=true)
*/
private $firstname;
/**
* @ORM\Column(type="string", length=64, nullable=true)
*/
private $lastname;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $birthday;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $city;
/**
* @ORM\Column(type="string", length=64, nullable=true)
*/
private $phone;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $facebookProfileLink;
/**
* @ORM\Column(name="avatar", type="string", nullable=true, options={"comment": "Avatar file path"})
*/
private $avatar;
/**
* @Vich\UploadableField(mapping="user_avatar", fileNameProperty="avatar")
* @Assert\File(maxSize="4194304")
* @Assert\Image()
*/
private $avatarFile;
/**
* @ORM\Column(type="text", nullable=true)
*/
public $deliveryAddress;
/**
* @ORM\Column(type="string", nullable=true, unique=true)
*/
private $fakeFullName;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $fakeAvatar;
/**
* @ORM\Column(type="boolean", options={"default" : false})
*/
private $deleted = false;
/**
* @ORM\Column(type="boolean", options={"default" : false})
*/
private $policyAgreement = false;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $registrationDate;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $updatedAt;
/**
* @ORM\Column(type="integer", options={"default": 0})
*/
private $currentBalance = 0;
/**
* @ORM\Column(type="json_array", options={"jsonb"=true}, nullable=true)
*/
private $appSettings = [];
/******************** END Summary **********************/
/******************** BEGIN Relations ******************/
/**
* @ORM\OneToMany(targetEntity="App\Entity\UserToken", mappedBy="user", orphanRemoval=true)
*/
private $userTokens;
/**
* @ORM\OneToMany(targetEntity="App\Entity\ShopOrder", mappedBy="user")
*/
private $shopOrders;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Resource", mappedBy="user")
*/
private $resources;
/**
* @ORM\OneToMany(targetEntity="App\Entity\MessageLog", mappedBy="user")
*/
private $messageLogs;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Permission", mappedBy="user")
*/
private $permissions;
/**
* @ORM\OneToMany(targetEntity=PermissionShop::class, mappedBy="user")
*/
private $permissionShops;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $country;
/**
* @ORM\ManyToMany(targetEntity=Shop::class, mappedBy="shopManagerUsers")
*/
private $managedShops;
/**
* @ORM\OneToMany(targetEntity=FAQ::class, mappedBy="userAuthor")
*/
private $fAQs;
/**
* @ORM\OneToMany(targetEntity=Article::class, mappedBy="userAuthor")
*/
private $articles;
/**
* @ORM\OneToMany(targetEntity=Pricing::class, mappedBy="author_user")
*/
private $pricings;
/**
* @ORM\OneToMany(targetEntity=Page::class, mappedBy="author_user")
*/
private $pages;
/**
* @ORM\OneToMany(targetEntity=Landing::class, mappedBy="author_user")
*/
private $landings;
/**
* @ORM\OneToMany(targetEntity=UserScoreLog::class, mappedBy="user")
*/
private $userScoreLogs;
/**
* @ORM\OneToMany(targetEntity=UserActionLog::class, mappedBy="user_id")
*/
private $userActionLogs;
/**
* @ORM\OneToMany(targetEntity=Game::class, mappedBy="user")
*/
private $games;
/**
* @ORM\OneToMany(targetEntity="App\Entity\UserArticleBookmark", mappedBy="user")
*/
private $userArticleBookmarks;
/**
* @ORM\OneToMany(targetEntity="App\Entity\UserProductBookmark", mappedBy="user")
*/
private $userProductBookmarks;
/**
* @ORM\ManyToOne(targetEntity=Language::class, inversedBy="users")
* @ORM\JoinColumn(name="selected_language_id", referencedColumnName="id", onDelete="SET NULL")
*/
private $selected_language;
/******************** END Relations ********************/
public function __construct()
{
parent::__construct();
$this->userTokens = new ArrayCollection();
$this->shopOrders = new ArrayCollection();
$this->resources = new ArrayCollection();
$this->messageLogs = new ArrayCollection();
$this->permissions = new ArrayCollection();
$this->permissionShops = new ArrayCollection();
$this->fAQs = new ArrayCollection();
$this->managedShops = new ArrayCollection();
$this->articles = new ArrayCollection();
$this->pricings = new ArrayCollection();
$this->pages = new ArrayCollection();
$this->landings = new ArrayCollection();
$this->userScoreLogs = new ArrayCollection();
$this->userActionLogs = new ArrayCollection();
$this->userArticleBookmarks = new ArrayCollection();
$this->userProductBookmarks = new ArrayCollection();
$this->games = new ArrayCollection();
}
/******************** BEGIN Getters and Setters ********************/
/**
* @return int
*/
public function getId(): int
{
return $this->id;
}
/**
* @return int
*/
public function getGender(): int
{
return $this->gender;
}
/**
* @param int $gender
* @return User
*/
public function setGender($gender): self
{
$this->gender = $gender;
return $this;
}
/**
* @return string|null
*/
public function getTheme(): ?string
{
return $this->theme;
}
/**
* @param $theme
* @return User
*/
public function setTheme($theme): self
{
$this->theme = $theme;
return $this;
}
/**
* @return array
*/
public function getAppSettings(): array
{
return $this->appSettings;
}
/**
* @param array $appSettings
* @return User
*/
public function setAppSettings(array $appSettings): self
{
$this->appSettings = $appSettings;
return $this;
}
/**
* @return string
*/
public function getStringGender()
{
return array_flip(self::GENDER)[$this->getGender()] ?? "undefined";
}
/**
* @return array
*/
public function getGenderList(): array
{
return array_keys(self::GENDER);
}
/**
* @return string
*/
public function getStringTheme(): string
{
return array_flip(self::THEME)[$this->getTheme()] ?? "undefined";
}
/**
* @return array
*/
public function getThemeList(): array
{
return array_keys(self::THEME);
}
/**
* @return string|null
*/
public function getFirstname(): ?string
{
return $this->firstname;
}
/**
* @param string|null $firstname
* @return User
*/
public function setFirstname($firstname): self
{
$this->firstname = $firstname;
return $this;
}
/**
* @return string|null
*/
public function getLastname(): ?string
{
return $this->lastname;
}
/**
* @param string|null $lastname
* @return User
*/
public function setLastname($lastname): self
{
$this->lastname = $lastname;
return $this;
}
/**
* @return DateTimeInterface|null
*/
public function getBirthday(): ?DateTimeInterface
{
return $this->birthday;
}
/**
* @param DateTimeInterface|null $birthday
* @return User
*/
public function setBirthday($birthday): self
{
$this->birthday = $birthday;
return $this;
}
/**
* @return string|null
*/
public function getCity(): ?string
{
return $this->city;
}
/**
* @param string|null $city
* @return User
*/
public function setCity($city): self
{
$this->city = $city;
return $this;
}
/**
* @return string|null
*/
public function getPhone(): ?string
{
return $this->phone;
}
/**
* @param string|null $phone
* @return User
*/
public function setPhone($phone): self
{
$this->phone = $phone;
return $this;
}
/**
* @return string|null
*/
public function getFacebookProfileLink(): ?string
{
return $this->facebookProfileLink;
}
/**
* @param string|null $facebookProfileLink
* @return User
*/
public function setFacebookProfileLink($facebookProfileLink): self
{
$this->facebookProfileLink = $facebookProfileLink;
return $this;
}
/**
* @return string|null
*/
public function getInstagramProfileLink(): ?string
{
return $this->instagramProfileLink;
}
/**
* @param string|null $instagramProfileLink
* @return User
*/
public function setInstagramProfileLink($instagramProfileLink): self
{
$this->instagramProfileLink = $instagramProfileLink;
return $this;
}
/**
* @return string|null
*/
public function getAvatar(): ?string
{
return $this->avatar;
}
/**
* @param string $avatar
* @return User
*/
public function setAvatar($avatar): self
{
$this->avatar = $avatar;
return $this;
}
/**
* @return File
*/
public function getAvatarFile(): ?File
{
return $this->avatarFile;
}
/**
* @param File|\Symfony\Component\HttpFoundation\File\UploadedFile $file
* @throws \Exception
*/
public function setAvatarFile(File $file = null)
{
$this->avatarFile = $file;
if (null !== $file) {
$this->updatedAt = new \DateTime();
}
}
/**
* @return string|null
*/
public function getAvatarUrl(): ?string
{
return $this->avatar ? '/uploads/files/user/' . $this->avatar : null;
}
/**
* @return string|null
*/
public function getDeliveryAddress(): ?string
{
return $this->deliveryAddress;
}
/**
* @param string|null $deliveryAddress
* @return User
*/
public function setDeliveryAddress($deliveryAddress): self
{
$this->deliveryAddress = $deliveryAddress;
return $this;
}
/**
* @return bool
*/
public function isPress(): bool
{
return $this->press;
}
/**
* @param bool $press
* @return User
*/
public function setPress($press): self
{
$this->press = $press;
return $this;
}
/**
* @return string
*/
public function getPressResourceName(): ?string
{
return $this->pressResourceName;
}
/**
* @param string $pressResourceName
* @return User
*/
public function setPressResourceName($pressResourceName): self
{
$this->pressResourceName = $pressResourceName;
return $this;
}
/**
* @return bool
*/
public function isHiddenIdentity(): bool
{
return $this->hiddenIdentity;
}
/**
* @param bool $hiddenIdentity
* @return User
*/
public function setHiddenIdentity($hiddenIdentity): self
{
$this->hiddenIdentity = $hiddenIdentity;
return $this;
}
/**
* @return string|null
*/
public function getFakeFullName()
{
return $this->fakeFullName;
}
/**
* @param string|null $fakeFullName
* @return User
*/
public function setFakeFullName($fakeFullName): self
{
$this->fakeFullName = $fakeFullName;
return $this;
}
/**
* @return string|null
*/
public function getFakeAvatar()
{
return $this->fakeAvatar;
}
/**
* @param string|null $fakeAvatar
* @return User
*/
public function setFakeAvatar($fakeAvatar): self
{
$this->fakeAvatar = $fakeAvatar;
return $this;
}
/**
* @return bool
*/
public function isDeleted(): bool
{
return $this->deleted;
}
/**
* @param bool $deleted
* @return User
*/
public function setDeleted($deleted): self
{
$this->deleted = $deleted;
return $this;
}
/**
* @return bool
*/
public function getPolicyAgreement(): bool
{
return $this->policyAgreement;
}
/**
* @param bool $policyAgreement
* @return User
*/
public function setPolicyAgreement($policyAgreement): self
{
$this->policyAgreement = $policyAgreement;
return $this;
}
/**
* @return DateTimeInterface|null
*/
public function getRegistrationDate(): ?DateTimeInterface
{
return $this->registrationDate;
}
/**
* @param DateTimeInterface $registrationDate
* @return User
*/
public function setRegistrationDate($registrationDate): self
{
$this->registrationDate = $registrationDate;
return $this;
}
/**
* @return \DateTimeInterface|null
*/
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
/**
* @return integer
*/
public function getCurrentBalance(): int
{
return $this->currentBalance;
}
/**
* @param integer $currentBalance
* @return User
*/
public function setCurrentBalance($currentBalance): self
{
$this->currentBalance = $currentBalance;
return $this;
}
/**
* @return Collection|ShopOrder[]
*/
public function getShopOrders(): Collection
{
return $this->shopOrders;
}
/**
* @return Collection|Resource[]
*/
public function getResources(): Collection
{
return $this->resources;
}
/**
* @return Collection|MessageLog[]
*/
public function getMessageLogs(): Collection
{
return $this->messageLogs;
}
/**
* @return Collection|Permission[]
*/
public function getPermissions(): Collection
{
return $this->permissions;
}
/**
* @return Collection|UserToken[]
*/
public function getUserTokens(): Collection
{
return $this->userTokens;
}
/**
* @param UserToken $userToken
* @return User
*/
public function addUserToken(UserToken $userToken): self
{
if (!$this->userTokens->contains($userToken)) {
$this->userTokens[] = $userToken;
$userToken->setUser($this);
}
return $this;
}
/**
* @param UserToken $userToken
* @return User
*/
public function removeUserToken(UserToken $userToken): self
{
if ($this->userTokens->contains($userToken)) {
$this->userTokens->removeElement($userToken);
// set the owning side to null (unless already changed)
if ($userToken->getUser() === $this) {
$userToken->setUser(null);
}
}
return $this;
}
/******************** END Getters and Setters ********************/
/**
* @return bool
*/
public function isAdmin()
{
return $this->hasRole(self::ROLE_ADMIN);
}
/**
* @return bool
*/
public function isShopManager()
{
return $this->hasRole(self::ROLE_SHOP_MANAGER);
}
// /**
// * @return bool
// */
// public function isImplementor()
// {
// return $this->hasRole(self::ROLE_IMPLEMENTOR);
// }
/**
* @ORM\PrePersist
*
* @throws \Exception
*/
public function onPrePersist()
{
$this->registrationDate = new \DateTime('now');
}
/**
* @ORM\PreUpdate
*
* @throws \Exception
*/
public function onPreUpdate()
{
$this->updatedAt = new \DateTime('now');
}
/**
* @return bool|null
*/
public function getPress(): ?bool
{
return $this->press;
}
/**
* @return bool|null
*/
public function getDeleted(): ?bool
{
return $this->deleted;
}
/**
* @param DateTimeInterface|null $updatedAt
* @return $this
*/
public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* @param ShopOrder $shopOrder
* @return $this
*/
public function addShopOrder(ShopOrder $shopOrder): self
{
if (!$this->shopOrders->contains($shopOrder)) {
$this->shopOrders[] = $shopOrder;
$shopOrder->setUser($this);
}
return $this;
}
/**
* @param ShopOrder $shopOrder
* @return $this
*/
public function removeShopOrder(ShopOrder $shopOrder): self
{
if ($this->shopOrders->contains($shopOrder)) {
$this->shopOrders->removeElement($shopOrder);
// set the owning side to null (unless already changed)
if ($shopOrder->getUser() === $this) {
$shopOrder->setUser(null);
}
}
return $this;
}
/**
* @return bool|null
*/
public function getHiddenIdentity(): ?bool
{
return $this->hiddenIdentity;
}
/**
* @param Permission $permission
* @return $this
*/
public function addPermission(Permission $permission): self
{
if (!$this->permissions->contains($permission)) {
$this->permissions[] = $permission;
$permission->setUser($this);
}
return $this;
}
/**
* @param Permission $permission
* @return $this
*/
public function removePermission(Permission $permission): self
{
if ($this->permissions->contains($permission)) {
$this->permissions->removeElement($permission);
// set the owning side to null (unless already changed)
if ($permission->getUser() === $this) {
$permission->setUser(null);
}
}
return $this;
}
/**
* @return Collection|PermissionShop[]
*/
public function getPermissionShops(): Collection
{
return $this->permissionShops;
}
/**
* @param PermissionShop $permissionShop
* @return $this
*/
public function addPermissionShop(PermissionShop $permissionShop): self
{
if (!$this->permissionShops->contains($permissionShop)) {
$this->permissionShops[] = $permissionShop;
$permissionShop->setUser($this);
}
return $this;
}
/**
* @param PermissionShop $permissionShop
* @return $this
*/
public function removePermissionShop(PermissionShop $permissionShop): self
{
if ($this->permissionShops->contains($permissionShop)) {
$this->permissionShops->removeElement($permissionShop);
// set the owning side to null (unless already changed)
if ($permissionShop->getUser() === $this) {
$permissionShop->setUser(null);
}
}
return $this;
}
/**
* @return string|null
*/
public function getCountry(): ?string
{
return $this->country;
}
/**
* @param string|null $country
* @return $this
*/
public function setCountry(?string $country): self
{
$this->country = $country;
return $this;
}
/**
* @return Collection|Shop[]
*/
public function getManagedShops(): Collection
{
return $this->managedShops;
}
/**
* @param Shop $managedShop
* @return $this
*/
public function addManagedShop(Shop $managedShop): self
{
if (!$this->managedShops->contains($managedShop)) {
$this->managedShops[] = $managedShop;
$managedShop->addShopManagerUser($this);
}
return $this;
}
/**
* @param Shop $managedShop
* @return $this
*/
public function removeManagedShop(Shop $managedShop): self
{
if ($this->managedShops->contains($managedShop)) {
$this->managedShops->removeElement($managedShop);
$managedShop->removeShopManagerUser($this);
}
return $this;
}
/**
* @return Collection|FAQ[]
*/
public function getFAQs(): Collection
{
return $this->fAQs;
}
/**
* @param FAQ $fAQ
* @return $this
*/
public function addFAQ(FAQ $fAQ): self
{
if (!$this->fAQs->contains($fAQ)) {
$this->fAQs[] = $fAQ;
$fAQ->setUserAuthor($this);
}
return $this;
}
/**
* @param FAQ $fAQ
* @return $this
*/
public function removeFAQ(FAQ $fAQ): self
{
if ($this->fAQs->contains($fAQ)) {
$this->fAQs->removeElement($fAQ);
// set the owning side to null (unless already changed)
if ($fAQ->getUserAuthor() === $this) {
$fAQ->setUserAuthor(null);
}
}
return $this;
}
/**
* @return Collection|Article[]
*/
public function getArticles(): Collection
{
return $this->articles;
}
/**
* @param Article $article
* @return $this
*/
public function addArticle(Article $article): self
{
if (!$this->articles->contains($article)) {
$this->articles[] = $article;
$article->setUserAuthor($this);
}
return $this;
}
/**
* @param Article $article
* @return $this
*/
public function removeArticle(Article $article): self
{
if ($this->articles->contains($article)) {
$this->articles->removeElement($article);
// set the owning side to null (unless already changed)
if ($article->getUserAuthor() === $this) {
$article->setUserAuthor(null);
}
}
return $this;
}
/**
* @return Collection
*/
public function getPricing(): Collection
{
return $this->pricings;
}
/**
* @param Pricing $pricing
* @return $this
*/
public function addPricing(Pricing $pricing): self
{
if (!$this->pricings->contains($pricing)) {
$this->pricings[] = $pricing;
$pricing->setUserAuthor($this);
}
return $this;
}
/**
* @param Pricing $pricing
* @return $this
*/
public function removePricing(Pricing $pricing): self
{
if ($this->pricings->contains($pricing)) {
$this->pricings->removeElement($pricing);
// set the owning side to null (unless already changed)
if ($pricing->getUserAuthor() === $this) {
$pricing->setUserAuthor(null);
}
}
return $this;
}
/**
* @return Collection|Page[]
*/
public function getPages(): Collection
{
return $this->pages;
}
/**
* @param Page $page
* @return $this
*/
public function addPage(Page $page): self
{
if (!$this->pages->contains($page)) {
$this->pages[] = $page;
$page->setAuthorUser($this);
}
return $this;
}
/**
* @param Page $page
* @return $this
*/
public function removePage(Page $page): self
{
if ($this->pages->contains($page)) {
$this->pages->removeElement($page);
// set the owning side to null (unless already changed)
if ($page->getAuthorUser() === $this) {
$page->setAuthorUser(null);
}
}
return $this;
}
/**
* @param Resource $resource
* @return User
*/
public function addResource(Resource $resource): self
{
if (!$this->resources->contains($resource)) {
$this->resources[] = $resource;
$resource->setUser($this);
}
return $this;
}
/**
* @param Resource $resource
* @return User
*/
public function removeResource(Resource $resource): self
{
if ($this->resources->contains($resource)) {
$this->resources->removeElement($resource);
// set the owning side to null (unless already changed)
if ($resource->getUser() === $this) {
$resource->setUser(null);
}
}
return $this;
}
/*
* @return Collection|Landing[]
*/
public function getLandings(): Collection
{
return $this->landings;
}
public function addLanding(Landing $landing): self
{
if (!$this->landings->contains($landing)) {
$this->landings[] = $landing;
$landing->setAuthorUser($this);
}
return $this;
}
/**
* @param MessageLog $messageLog
* @return User
*/
public function addMessageLog(MessageLog $messageLog): self
{
if (!$this->messageLogs->contains($messageLog)) {
$this->messageLogs[] = $messageLog;
$messageLog->setUser($this);
}
return $this;
}
public function removeLanding(Landing $landing): self
{
if ($this->landings->contains($landing)) {
$this->landings->removeElement($landing);
// set the owning side to null (unless already changed)
if ($landing->getAuthorUser() === $this) {
$landing->setAuthorUser(null);
}
}
return $this;
}
/**
* @param MessageLog $messageLog
* @return User
*/
public function removeMessageLog(MessageLog $messageLog): self
{
if ($this->messageLogs->contains($messageLog)) {
$this->messageLogs->removeElement($messageLog);
// set the owning side to null (unless already changed)
if ($messageLog->getUser() === $this) {
$messageLog->setUser(null);
}
}
return $this;
}
/*
* @return Collection|UserScoreLog[]
*/
public function getUserScoreLogs(): Collection
{
return $this->userScoreLogs;
}
public function addUserScoreLog(UserScoreLog $userScoreLog): self
{
if (!$this->userScoreLogs->contains($userScoreLog)) {
$this->userScoreLogs[] = $userScoreLog;
$userScoreLog->setUserId($this);
}
return $this;
}
public function removeUserScoreLog(UserScoreLog $userScoreLog): self
{
if ($this->userScoreLogs->contains($userScoreLog)) {
$this->userScoreLogs->removeElement($userScoreLog);
// set the owning side to null (unless already changed)
if ($userScoreLog->getUserId() === $this) {
$userScoreLog->setUserId(null);
}
}
return $this;
}
/**
* @return Collection|UserActionLog[]
*/
public function getUserActionLogs(): Collection
{
return $this->userActionLogs;
}
public function addUserActionLog(UserActionLog $userActionLog): self
{
if (!$this->userActionLogs->contains($userActionLog)) {
$this->userActionLogs[] = $userActionLog;
$userActionLog->setUserId($this);
}
return $this;
}
public function removeUserActionLog(UserActionLog $userActionLog): self
{
if ($this->userActionLogs->contains($userActionLog)) {
$this->userActionLogs->removeElement($userActionLog);
// set the owning side to null (unless already changed)
if ($userActionLog->getUserId() === $this) {
$userActionLog->setUserId(null);
}
}
return $this;
}
/**
* @return Collection|Game[]
*/
public function getGames(): Collection
{
return $this->games;
}
public function addGame(Game $game): self
{
if (!$this->games->contains($game)) {
$this->games[] = $game;
$game->setUser($this);
}
return $this;
}
public function removeGame(Game $game): self
{
if ($this->games->contains($game)) {
$this->games->removeElement($game);
// set the owning side to null (unless already changed)
if ($game->getUser() === $this) {
$game->setUser(null);
}
}
return $this;
}
/**
* @return Collection|UserArticleBookmark[]
*/
public function getUserArticleBookmarks(): Collection
{
return $this->userArticleBookmarks;
}
/**
* @param UserArticleBookmark $userArticleBookmark
* @return $this
*/
public function addUserArticleBookmark(UserArticleBookmark $userArticleBookmark): self
{
if (!$this->userArticleBookmarks->contains($userArticleBookmark)) {
$this->userArticleBookmarks[] = $userArticleBookmark;
$userArticleBookmark->setUser($this);
}
return $this;
}
/**
* @param UserArticleBookmark $userArticleBookmark
* @return $this
*/
public function removeUserArticleBookmark(UserArticleBookmark $userArticleBookmark): self
{
if ($this->userArticleBookmarks->contains($userArticleBookmark)) {
$this->userArticleBookmarks->removeElement($userArticleBookmark);
// set the owning side to null (unless already changed)
if ($userArticleBookmark->getUser() === $this) {
$userArticleBookmark->setUser(null);
}
}
return $this;
}
/**
* @return Collection|UserProductBookmark[]
*/
public function getUserProductBookmarks(): Collection
{
return $this->userProductBookmarks;
}
/**
* @param UserProductBookmark $userProductBookmark
* @return $this
*/
public function addUserProductBookmark(UserProductBookmark $userProductBookmark): self
{
if (!$this->userProductBookmarks->contains($userProductBookmark)) {
$this->userProductBookmarks[] = $userProductBookmark;
$userProductBookmark->setUser($this);
}
return $this;
}
/**
* @param UserProductBookmark $userProductBookmark
* @return $this
*/
public function removeUserProductBookmark(UserProductBookmark $userProductBookmark): self
{
if ($this->userProductBookmarks->contains($userProductBookmark)) {
$this->userProductBookmarks->removeElement($userProductBookmark);
// set the owning side to null (unless already changed)
if ($userProductBookmark->getUser() === $this) {
$userProductBookmark->setUser(null);
}
}
return $this;
}
public function getSelectedLanguage(): ?Language
{
return $this->selected_language;
}
public function setSelectedLanguage(?Language $selected_language): self
{
$this->selected_language = $selected_language;
return $this;
}
}