src/Entity/User.php line 31

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Enum\AccountType;
  4. use App\Enum\PaymentDataEnum;
  5. use App\Enum\PaymentType;
  6. use App\Enum\SubscriptionStatus;
  7. use App\Helper\MetaAttributionHelper;
  8. use App\Helper\PaymentDataConstants;
  9. use App\Helper\SettingConstants;
  10. use App\Interfaces\IBasicUser;
  11. use Doctrine\Common\Collections\ArrayCollection;
  12. use Doctrine\Common\Collections\Collection;
  13. use Doctrine\ORM\Mapping as ORM;
  14. use Knp\DoctrineBehaviors\Model\Translatable\TranslatableTrait;
  15. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  16. use Symfony\Component\Security\Core\User\UserInterface;
  17. #[ORM\Table(name'user')]
  18. #[ORM\Index(name'IX_email'columns: ['email'])]
  19. #[ORM\Index(name'IX_opt_in_hash'columns: ['opt_in_hash'])]
  20. #[ORM\Index(name'IX_public_profile_hash'columns: ['public_profile_hash'])]
  21. #[ORM\Index(name'ix_nickname'columns: ['nickname'])]
  22. #[ORM\Index(name'ix_reset_hash'columns: ['reset_hash'])]
  23. #[ORM\Index(name'ix_referral_code'columns: ['v_referral_code'])]
  24. #[ORM\Index(name'ix_source'columns: ['v_source'], options: ["lengths" => [255]])]
  25. #[ORM\Index(name'ix_mention_tag'columns: ['v_mention_tag'])]
  26. #[ORM\Index(name'ix_social_login_user_id'columns: ['v_social_login_user_id'])]
  27. #[ORM\Entity(repositoryClass'App\Entity\Repository\UserRepository')]
  28. class User implements UserInterfacePasswordAuthenticatedUserInterfaceIBasicUser
  29. {
  30.     use TranslatableTrait;
  31.     public const DEFAULT_LOCALE 'de';
  32.     // this value defines how many edits a user has to make to be asked to join the moderators
  33.     public const MODERATION_TARGET 20;
  34.     #[ORM\Id]
  35.     #[ORM\Column(type'integer')]
  36.     #[ORM\GeneratedValue(strategy'AUTO')]
  37.     private $id;
  38.     #[ORM\Column(type'string'nullabletrue)]
  39.     private $email;
  40.     #[ORM\Column(type'string'nullabletrue)]
  41.     private $password;
  42.     #[ORM\Column(type'string'nullabletrue)]
  43.     private $salt;
  44.     #[ORM\Column(type'string'nullabletrue)]
  45.     private $firstname;
  46.     #[ORM\Column(type'string'nullabletrue)]
  47.     private $lastname;
  48.     #[ORM\Column(type'string'nullabletrue)]
  49.     private $nickname;
  50.     #[ORM\Column(type'string'nullabletrue)]
  51.     private $address_line1;
  52.     #[ORM\Column(type'string'nullabletrue)]
  53.     private $address_line2;
  54.     #[ORM\Column(type'string'nullabletrue)]
  55.     private $zip_code;
  56.     #[ORM\Column(type'string'nullabletrue)]
  57.     private $city;
  58.     #[ORM\Column(type'string'nullabletrue)]
  59.     private $country_iso;
  60.     #[ORM\Column(type'string'nullabletrue)]
  61.     private $phone;
  62.     #[ORM\Column(type'string'nullabletrue)]
  63.     private $mobile;
  64.     #[ORM\Column(type'json'nullabletrue)]
  65.     private $profile;
  66.     #[ORM\Column(type'datetime'nullablefalse)]
  67.     private $date_created;
  68.     #[ORM\Column(type'boolean'nullabletrue)]
  69.     private $is_public;
  70.     #[ORM\Column(type'string'nullabletrue)]
  71.     private $public_profile_hash;
  72.     #[ORM\Column(type'integer'nullabletrue)]
  73.     private $login_count;
  74.     #[ORM\Column(type'text'nullabletrue)]
  75.     private $about_me;
  76.     #[ORM\Column(type'datetime'nullabletrue)]
  77.     private $date_last_login;
  78.     #[ORM\Column(type'datetime'nullabletrue)]
  79.     private $date_disabled;
  80.     #[ORM\Column(type'datetime'nullabletrue)]
  81.     private $date_opt_in_confirmed;
  82.     #[ORM\Column(type'float'nullabletrue)]
  83.     private $geo_lat;
  84.     #[ORM\Column(type'float'nullabletrue)]
  85.     private $geo_lon;
  86.     #[ORM\Column(type'string'nullabletrue)]
  87.     private $reset_hash;
  88.     #[ORM\Column(type'datetime'nullabletrue)]
  89.     private $date_reset_created;
  90.     #[ORM\Column(type'json'nullabletrue)]
  91.     private $settings;
  92.     #[ORM\Column(type'boolean'nullablefalse)]
  93.     private $is_active;
  94.     #[ORM\Column(type'string'nullabletrue)]
  95.     private $opt_in_hash;
  96.     #[ORM\Column(type'string'nullabletrue)]
  97.     private $account_type;
  98.     #[ORM\Column(type'json'nullabletrue)]
  99.     private $payment_data;
  100.     #[ORM\OneToMany(targetEntity'App\Entity\Token'mappedBy'user')]
  101.     private $token;
  102.     #[ORM\OneToMany(targetEntity'App\Entity\Crop'mappedBy'user')]
  103.     private $crop;
  104.     #[ORM\OneToMany(targetEntity'App\Entity\SupportRequest'mappedBy'user')]
  105.     private $supportRequest;
  106.     #[ORM\OneToMany(targetEntity'App\Entity\Emaillog'mappedBy'user')]
  107.     private $notificationMail;
  108.     #[ORM\OneToMany(targetEntity'App\Entity\Patch'mappedBy'user')]
  109.     private $patch;
  110.     #[ORM\OneToMany(targetEntity'App\Entity\Cropaction'mappedBy'user')]
  111.     private $cropaction;
  112.     #[ORM\OneToMany(targetEntity'App\Entity\Todo'mappedBy'user')]
  113.     private $todo;
  114.     #[ORM\OneToMany(targetEntity'App\Entity\Shoporder'mappedBy'user')]
  115.     private $shoporder;
  116.     #[ORM\OneToMany(targetEntity'App\Entity\FavoriteCrop'mappedBy'user')]
  117.     private $favoriteCrop;
  118.     #[ORM\OneToMany(targetEntity'App\Entity\FavoriteContent'mappedBy'user')]
  119.     private $contentFavorite;
  120.     #[ORM\OneToMany(targetEntity'App\Entity\Invoice'mappedBy'user')]
  121.     private $invoice;
  122.     #[ORM\OneToMany(targetEntity'App\Entity\Payment'mappedBy'user')]
  123.     private $payment;
  124.     #[ORM\OneToMany(targetEntity'App\Entity\LoginLog'mappedBy'user')]
  125.     private $loginLog;
  126.     #[ORM\OneToMany(targetEntity'App\Entity\VoucherRedemption'mappedBy'user')]
  127.     private $voucherRedemption;
  128.     #[ORM\OneToMany(targetEntity'App\Entity\Device'mappedBy'user')]
  129.     private $device;
  130.     #[ORM\OneToMany(targetEntity'App\Entity\Survey'mappedBy'user')]
  131.     private $survey;
  132.     #[ORM\OneToMany(targetEntity'App\Entity\Post'mappedBy'user')]
  133.     private $post;
  134.     #[ORM\OneToMany(targetEntity'App\Entity\PostComment'mappedBy'user')]
  135.     private $postComment;
  136.     #[ORM\OneToMany(targetEntity'App\Entity\PostBookmark'mappedBy'user')]
  137.     private $postBookmark;
  138.     #[ORM\OneToMany(targetEntity'App\Entity\Rating'mappedBy'user')]
  139.     private $rating;
  140.     #[ORM\OneToMany(targetEntity'App\Entity\Appsurvey'mappedBy'user')]
  141.     private $appsurvey;
  142.     #[ORM\OneToMany(targetEntity'App\Entity\PushNotification'mappedBy'user')]
  143.     private $pushNotification;
  144.     #[ORM\OneToMany(targetEntity'App\Entity\Image'mappedBy'user')]
  145.     private $image;
  146.     #[ORM\OneToMany(targetEntity'App\Entity\CropEdit'mappedBy'user')]
  147.     private $cropEdit;
  148.     #[ORM\OneToMany(targetEntity'App\Entity\CropRating'mappedBy'user')]
  149.     private $cropRating;
  150.     #[ORM\OneToMany(targetEntity'App\Entity\CartItem'mappedBy'user')]
  151.     private $cartItem;
  152.     #[ORM\OneToMany(targetEntityGarden::class, mappedBy'user')]
  153.     private $gardens;
  154.     #[ORM\OneToMany(targetEntityPostLike::class, mappedBy'user')]
  155.     private $postLikes;
  156.     #[ORM\OneToMany(targetEntityCommentLike::class, mappedBy'user')]
  157.     private $commentLikes;
  158.     #[ORM\OneToMany(targetEntityNotification::class, mappedBy'user')]
  159.     private $notifications;
  160.     #[ORM\OneToMany(targetEntityNps::class, mappedBy'user'orphanRemovaltrue)]
  161.     private $nps;
  162.     #[ORM\OneToMany(targetEntityUserConnection::class, mappedBy'user')]
  163.     private $userConnections;
  164.     #[ORM\OneToMany(targetEntityReminder::class, mappedBy'user'orphanRemovaltrue)]
  165.     private $reminders;
  166.     private $imageDataUri;
  167.     #[ORM\OneToMany(targetEntityProfitwellUser::class, mappedBy'user'orphanRemovaltrue)]
  168.     private $profitwellUsers;
  169.     #[ORM\OneToMany(targetEntityTemplate::class, mappedBy'created_by_user')]
  170.     private $templates;
  171.     #[ORM\OneToMany(targetEntityFavoriteTemplate::class, mappedBy'user'orphanRemovaltrue)]
  172.     private $favoriteTemplates;
  173.     #[ORM\OneToMany(targetEntityTemplateUsage::class, mappedBy'user'orphanRemovaltrue)]
  174.     private $templateUsages;
  175.     #[ORM\OneToMany(targetEntityObjectComment::class, mappedBy'user'orphanRemovaltrue)]
  176.     private $objectComments;
  177.     #[ORM\OneToMany(targetEntityPreferencesToken::class, mappedBy'user'orphanRemovaltrue)]
  178.     private $preferencesTokens;
  179.     #[ORM\OneToMany(targetEntityUsercontent::class, mappedBy'user'orphanRemovaltrue)]
  180.     private $usercontents;
  181.     #[ORM\OneToMany(targetEntityTagConnection::class, mappedBy'user'orphanRemovaltrue)]
  182.     private $tagConnections;
  183.     #[ORM\OneToMany(mappedBy'user'targetEntityCroplist::class, orphanRemovaltrue)]
  184.     private Collection $cropLists;
  185.     #[ORM\Column(length6nullabletrue)]
  186.     private ?string $locale null;
  187.     #[ORM\OneToMany(mappedBy'user'targetEntityCancellationSurvey::class, orphanRemovaltrue)]
  188.     private Collection $cancellationSurveys;
  189.     // this virtual column is indexed via an index at the top of this file; the indexed virtual column
  190.     // helps to speed up lookups for users with a referral code which is used during register
  191.     #[ORM\Column(type"string",
  192.         name"v_referral_code",
  193.         columnDefinition"VARCHAR(50) AS (JSON_VALUE(settings,'$.referralCode')) VIRTUAL",
  194.         insertablefalse,
  195.         updatablefalse,
  196.         nullabletrue,
  197.         length50,
  198.         generated"ALWAYS")]
  199.     private ?string $v_referralCode;
  200.     // this indexed virtual column helps to speed up selects to the source of users
  201.     #[ORM\Column(type"string",
  202.         name"v_source",
  203.         columnDefinition"VARCHAR(4096) AS (JSON_VALUE(settings,'$.source')) VIRTUAL",
  204.         insertablefalse,
  205.         updatablefalse,
  206.         nullabletrue,
  207.         length4096,
  208.         generated"ALWAYS")]
  209.     private ?string $v_source;
  210.     // this indexed virtual column helps to speed up selects of users via mention tags
  211.     #[ORM\Column(type"string",
  212.         name"v_mention_tag",
  213.         columnDefinition"VARCHAR(255) AS (JSON_VALUE(settings,'$.mentionTag')) VIRTUAL",
  214.         insertablefalse,
  215.         updatablefalse,
  216.         nullabletrue,
  217.         length255,
  218.         generated"ALWAYS")]
  219.     private ?string $v_mentionTag;
  220.     // this indexed virtual column helps to speed up selects of users via social login user id
  221.     #[ORM\Column(type"string",
  222.         name"v_social_login_user_id",
  223.         columnDefinition"VARCHAR(100) AS (JSON_VALUE(settings,'$.socialLoginUserId')) VIRTUAL",
  224.         insertablefalse,
  225.         updatablefalse,
  226.         nullabletrue,
  227.         length100,
  228.         generated"ALWAYS")]
  229.     private ?string $v_socialLoginUserId;
  230.     #[ORM\OneToMany(mappedBy'user'targetEntityModerationNotification::class)]
  231.     private Collection $moderationNotifications;
  232.     #[ORM\Column(nullabletrue)]
  233.     private ?array $climate_settings = [];
  234.     #[ORM\Column(nullabletrue)]
  235.     private ?array $units = [];
  236.     #[ORM\OneToMany(mappedBy'reported_by_user_id'targetEntityPostReport::class, orphanRemovaltrue)]
  237.     private Collection $postReports;
  238.     public function __construct()
  239.     {
  240.         $this->date_created = new \DateTime();
  241.         $this->is_active false;
  242.         $this->token = new ArrayCollection();
  243.         $this->supportRequest = new ArrayCollection();
  244.         $this->notificationMail = new ArrayCollection();
  245.         $this->patch = new ArrayCollection();
  246.         $this->todo = new ArrayCollection();
  247.         $this->shoporder = new ArrayCollection();
  248.         $this->favoriteCrop = new ArrayCollection();
  249.         $this->contentFavorite = new ArrayCollection();
  250.         $this->invoice = new ArrayCollection();
  251.         $this->payment = new ArrayCollection();
  252.         $this->crop = new ArrayCollection();
  253.         $this->loginLog = new ArrayCollection();
  254.         $this->voucherRedemption = new ArrayCollection();
  255.         $this->device = new ArrayCollection();
  256.         $this->cropaction = new ArrayCollection();
  257.         $this->survey = new ArrayCollection();
  258.         $this->post = new ArrayCollection();
  259.         $this->postComment = new ArrayCollection();
  260.         $this->postBookmark = new ArrayCollection();
  261.         $this->rating = new ArrayCollection();
  262.         $this->appsurvey = new ArrayCollection();
  263.         $this->pushNotification = new ArrayCollection();
  264.         $this->image = new ArrayCollection();
  265.         $this->cropEdit = new ArrayCollection();
  266.         $this->cropRating = new ArrayCollection();
  267.         $this->cartItem = new ArrayCollection();
  268.         $this->gardens = new ArrayCollection();
  269.         $this->postLikes = new ArrayCollection();
  270.         $this->commentLikes = new ArrayCollection();
  271.         $this->notifications = new ArrayCollection();
  272.         $this->nps = new ArrayCollection();
  273.         $this->userConnections = new ArrayCollection();
  274.         $this->reminders = new ArrayCollection();
  275.         $this->profitwellUsers = new ArrayCollection();
  276.         $this->templates = new ArrayCollection();
  277.         $this->favoriteTemplates = new ArrayCollection();
  278.         $this->templateUsages = new ArrayCollection();
  279.         $this->objectComments = new ArrayCollection();
  280.         $this->preferencesTokens = new ArrayCollection();
  281.         $this->usercontents = new ArrayCollection();
  282.         $this->tagConnections = new ArrayCollection();
  283.         $this->cropLists = new ArrayCollection();
  284.         $this->cancellationSurveys = new ArrayCollection();
  285.         $this->moderationNotifications = new ArrayCollection();
  286.         $this->postReports = new ArrayCollection();
  287.     }
  288.     public function getId(): ?int
  289.     {
  290.         return $this->id;
  291.     }
  292.     public function getEmail(): ?string
  293.     {
  294.         return $this->email;
  295.     }
  296.     public function setEmail(?string $email): self
  297.     {
  298.         $this->email $email;
  299.         return $this;
  300.     }
  301.     public function getFirstname(): ?string
  302.     {
  303.         return $this->firstname;
  304.     }
  305.     public function setFirstname(?string $firstname): self
  306.     {
  307.         $this->firstname $firstname;
  308.         return $this;
  309.     }
  310.     public function getAddressLine1(): ?string
  311.     {
  312.         return $this->address_line1;
  313.     }
  314.     public function setAddressLine1(?string $address_line1): self
  315.     {
  316.         $this->address_line1 $address_line1;
  317.         return $this;
  318.     }
  319.     public function getAddressLine2(): ?string
  320.     {
  321.         return $this->address_line2;
  322.     }
  323.     public function setAddressLine2(?string $address_line2): self
  324.     {
  325.         $this->address_line2 $address_line2;
  326.         return $this;
  327.     }
  328.     public function getZipCode(): ?string
  329.     {
  330.         return $this->zip_code;
  331.     }
  332.     public function setZipCode(?string $zip_code): self
  333.     {
  334.         $this->zip_code $zip_code;
  335.         return $this;
  336.     }
  337.     public function getCity(): ?string
  338.     {
  339.         return $this->city;
  340.     }
  341.     public function setCity(?string $city): self
  342.     {
  343.         $this->city $city;
  344.         return $this;
  345.     }
  346.     public function getCountryIso(): ?string
  347.     {
  348.         return $this->country_iso;
  349.     }
  350.     public function setCountryIso(?string $country_iso): self
  351.     {
  352.         $this->country_iso $country_iso;
  353.         return $this;
  354.     }
  355.     public function getPhone(): ?string
  356.     {
  357.         return $this->phone;
  358.     }
  359.     public function setPhone(?string $phone): self
  360.     {
  361.         $this->phone $phone;
  362.         return $this;
  363.     }
  364.     public function getMobile(): ?string
  365.     {
  366.         return $this->mobile;
  367.     }
  368.     public function setMobile(?string $mobile): self
  369.     {
  370.         $this->mobile $mobile;
  371.         return $this;
  372.     }
  373.     public function getDateCreated(): ?\DateTimeInterface
  374.     {
  375.         return $this->date_created;
  376.     }
  377.     public function setDateCreated(\DateTimeInterface $date_created): self
  378.     {
  379.         $this->date_created $date_created;
  380.         return $this;
  381.     }
  382.     public function getDateOptInConfirmed(): ?\DateTimeInterface
  383.     {
  384.         return $this->date_opt_in_confirmed;
  385.     }
  386.     public function setDateOptInConfirmed(?\DateTimeInterface $date_opt_in_confirmed): self
  387.     {
  388.         $this->date_opt_in_confirmed $date_opt_in_confirmed;
  389.         return $this;
  390.     }
  391.     public function getIsActive(): ?bool
  392.     {
  393.         return $this->is_active;
  394.     }
  395.     public function setIsActive(bool $is_active): self
  396.     {
  397.         $this->is_active $is_active;
  398.         return $this;
  399.     }
  400.     public function getPassword(): ?string
  401.     {
  402.         return $this->password;
  403.     }
  404.     public function setPassword(?string $password): self
  405.     {
  406.         $this->password $password;
  407.         return $this;
  408.     }
  409.     /**
  410.      * @return Collection|Token[]
  411.      */
  412.     public function getToken(): Collection
  413.     {
  414.         return $this->token;
  415.     }
  416.     public function addToken(Token $token): self
  417.     {
  418.         if (!$this->token->contains($token)) {
  419.             $this->token[] = $token;
  420.             $token->setUser($this);
  421.         }
  422.         return $this;
  423.     }
  424.     public function removeToken(Token $token): self
  425.     {
  426.         if ($this->token->contains($token)) {
  427.             $this->token->removeElement($token);
  428.             // set the owning side to null (unless already changed)
  429.             if ($token->getUser() === $this) {
  430.                 $token->setUser(null);
  431.             }
  432.         }
  433.         return $this;
  434.     }
  435.     public function getOptInHash(): ?string
  436.     {
  437.         return $this->opt_in_hash;
  438.     }
  439.     public function setOptInHash(?string $opt_in_hash): self
  440.     {
  441.         $this->opt_in_hash $opt_in_hash;
  442.         return $this;
  443.     }
  444.     public function getAccountType(): ?string
  445.     {
  446.         return $this->account_type;
  447.     }
  448.     public function setAccountType(?string $account_type): self
  449.     {
  450.         $this->account_type $account_type;
  451.         $now = new \DateTime();
  452.         if ($account_type === AccountType::Paid->value &&
  453.             $now > new \DateTime('2024-04-14 00:00:00') &&
  454.             $now < new \DateTime('2025-04-22 23:59:59')) {
  455.             // easter activation 2025
  456.             $this->setSetting(SettingConstants::UNLOCKED_DECORATIONS,
  457.                 ["easterNest""easterBunnyFront""easterBunnyBack"]);
  458.         }
  459.         return $this;
  460.     }
  461.     public function eraseCredentials()
  462.     {
  463.         // TODO: Implement eraseCredentials() method.
  464.     }
  465.     public function getSalt(): ?string
  466.     {
  467.         return $this->salt;
  468.     }
  469.     public function getRoles()
  470.     {
  471.         return ['ROLE_USER'];
  472.     }
  473.     public function getUsername()
  474.     {
  475.         return $this->getEmail();
  476.     }
  477.     /**
  478.      * @return Collection|SupportRequest[]
  479.      */
  480.     public function getSupportRequest(): Collection
  481.     {
  482.         return $this->supportRequest;
  483.     }
  484.     public function addSupportRequest(SupportRequest $supportRequest): self
  485.     {
  486.         if (!$this->supportRequest->contains($supportRequest)) {
  487.             $this->supportRequest[] = $supportRequest;
  488.             $supportRequest->setUser($this);
  489.         }
  490.         return $this;
  491.     }
  492.     public function removeSupportRequest(SupportRequest $supportRequest): self
  493.     {
  494.         if ($this->supportRequest->contains($supportRequest)) {
  495.             $this->supportRequest->removeElement($supportRequest);
  496.             // set the owning side to null (unless already changed)
  497.             if ($supportRequest->getUser() === $this) {
  498.                 $supportRequest->setUser(null);
  499.             }
  500.         }
  501.         return $this;
  502.     }
  503.     public function setSalt(?string $salt): self
  504.     {
  505.         $this->salt $salt;
  506.         return $this;
  507.     }
  508.     public function getLastname(): ?string
  509.     {
  510.         return $this->lastname;
  511.     }
  512.     public function setLastname(?string $lastname): self
  513.     {
  514.         $this->lastname $lastname;
  515.         return $this;
  516.     }
  517.     public function getNickname(): ?string
  518.     {
  519.         return $this->nickname;
  520.     }
  521.     public function setNickname(?string $nickname): self
  522.     {
  523.         $this->nickname $nickname;
  524.         return $this;
  525.     }
  526.     public function getGeoLat(): ?float
  527.     {
  528.         return $this->geo_lat;
  529.     }
  530.     public function setGeoLat(?float $geo_lat): self
  531.     {
  532.         $this->geo_lat $geo_lat;
  533.         return $this;
  534.     }
  535.     public function getGeoLon(): ?float
  536.     {
  537.         return $this->geo_lon;
  538.     }
  539.     public function setGeoLon(?float $geo_lon): self
  540.     {
  541.         $this->geo_lon $geo_lon;
  542.         return $this;
  543.     }
  544.     /**
  545.      * @return Collection|Patch[]
  546.      */
  547.     public function getPatch(): Collection
  548.     {
  549.         return $this->patch;
  550.     }
  551.     public function addPatch(Patch $patch): self
  552.     {
  553.         if (!$this->patch->contains($patch)) {
  554.             $this->patch[] = $patch;
  555.             $patch->setUser($this);
  556.         }
  557.         return $this;
  558.     }
  559.     public function removePatch(Patch $patch): self
  560.     {
  561.         if ($this->patch->contains($patch)) {
  562.             $this->patch->removeElement($patch);
  563.             // set the owning side to null (unless already changed)
  564.             if ($patch->getUser() === $this) {
  565.                 $patch->setUser(null);
  566.             }
  567.         }
  568.         return $this;
  569.     }
  570.     /**
  571.      * @return Collection|Todo[]
  572.      */
  573.     public function getTodo(): Collection
  574.     {
  575.         return $this->todo;
  576.     }
  577.     public function addTodo(Todo $todo): self
  578.     {
  579.         if (!$this->todo->contains($todo)) {
  580.             $this->todo[] = $todo;
  581.             $todo->setUser($this);
  582.         }
  583.         return $this;
  584.     }
  585.     public function removeTodo(Todo $todo): self
  586.     {
  587.         if ($this->todo->contains($todo)) {
  588.             $this->todo->removeElement($todo);
  589.             // set the owning side to null (unless already changed)
  590.             if ($todo->getUser() === $this) {
  591.                 $todo->setUser(null);
  592.             }
  593.         }
  594.         return $this;
  595.     }
  596.     /**
  597.      * @return Collection|Shoporder[]
  598.      */
  599.     public function getShoporder(): Collection
  600.     {
  601.         return $this->shoporder;
  602.     }
  603.     public function addShoporder(Shoporder $shoporder): self
  604.     {
  605.         if (!$this->shoporder->contains($shoporder)) {
  606.             $this->shoporder[] = $shoporder;
  607.             $shoporder->setUser($this);
  608.         }
  609.         return $this;
  610.     }
  611.     public function removeShoporder(Shoporder $shoporder): self
  612.     {
  613.         if ($this->shoporder->contains($shoporder)) {
  614.             $this->shoporder->removeElement($shoporder);
  615.             // set the owning side to null (unless already changed)
  616.             if ($shoporder->getUser() === $this) {
  617.                 $shoporder->setUser(null);
  618.             }
  619.         }
  620.         return $this;
  621.     }
  622.     public function getPaymentData()
  623.     {
  624.         return $this->payment_data;
  625.     }
  626.     public function setPaymentData($payment_data): self
  627.     {
  628.         $this->payment_data $payment_data;
  629.         return $this;
  630.     }
  631.     public function getPaymentDataField(string $field): mixed
  632.     {
  633.         return $this->payment_data[$field] ?? null;
  634.     }
  635.     public function setPaymentDataField(string $fieldmixed $value): self
  636.     {
  637.         $allowedFields = [
  638.             PaymentDataConstants::PAYPAL_FAILURE_EMAIL_SENT,
  639.             PaymentDataConstants::STATE,
  640.             PaymentDataConstants::VALID_UNTIL,
  641.             PaymentDataConstants::TYPE,
  642.             PaymentDataConstants::PADDLE_ID
  643.         ];
  644.         if (!in_array($field$allowedFields)) {
  645.             throw new \Exception('invalid payment data field');
  646.         }
  647.         if ($this->payment_data === null) {
  648.             $this->payment_data = [];
  649.         }
  650.         $this->payment_data[$field] = $value;
  651.         return $this;
  652.     }
  653.     /**
  654.      * @return Collection|FavoriteCrop[]
  655.      */
  656.     public function getFavoriteCrop(): Collection
  657.     {
  658.         return $this->favoriteCrop;
  659.     }
  660.     public function addFavoriteCrop(FavoriteCrop $favoriteCrop): self
  661.     {
  662.         if (!$this->favoriteCrop->contains($favoriteCrop)) {
  663.             $this->favoriteCrop[] = $favoriteCrop;
  664.             $favoriteCrop->setUser($this);
  665.         }
  666.         return $this;
  667.     }
  668.     public function removeFavoriteCrop(FavoriteCrop $favoriteCrop): self
  669.     {
  670.         if ($this->favoriteCrop->contains($favoriteCrop)) {
  671.             $this->favoriteCrop->removeElement($favoriteCrop);
  672.             // set the owning side to null (unless already changed)
  673.             if ($favoriteCrop->getUser() === $this) {
  674.                 $favoriteCrop->setUser(null);
  675.             }
  676.         }
  677.         return $this;
  678.     }
  679.     /**
  680.      * @return Collection|FavoriteContent[]
  681.      */
  682.     public function getContentFavorite(): Collection
  683.     {
  684.         return $this->contentFavorite;
  685.     }
  686.     public function addContentFavorite(FavoriteContent $contentFavorite): self
  687.     {
  688.         if (!$this->contentFavorite->contains($contentFavorite)) {
  689.             $this->contentFavorite[] = $contentFavorite;
  690.             $contentFavorite->setUser($this);
  691.         }
  692.         return $this;
  693.     }
  694.     public function removeContentFavorite(FavoriteContent $contentFavorite): self
  695.     {
  696.         if ($this->contentFavorite->contains($contentFavorite)) {
  697.             $this->contentFavorite->removeElement($contentFavorite);
  698.             // set the owning side to null (unless already changed)
  699.             if ($contentFavorite->getUser() === $this) {
  700.                 $contentFavorite->setUser(null);
  701.             }
  702.         }
  703.         return $this;
  704.     }
  705.     public function getSettings()
  706.     {
  707.         return $this->settings;
  708.     }
  709.     public function setSettings($settings): self
  710.     {
  711.         $this->settings $settings;
  712.         return $this;
  713.     }
  714.     /**
  715.      * @return Collection|Emaillog[]
  716.      */
  717.     public function getNotificationMail(): Collection
  718.     {
  719.         return $this->notificationMail;
  720.     }
  721.     public function addNotificationMail(Emaillog $notificationMail): self
  722.     {
  723.         if (!$this->notificationMail->contains($notificationMail)) {
  724.             $this->notificationMail[] = $notificationMail;
  725.             $notificationMail->setUser($this);
  726.         }
  727.         return $this;
  728.     }
  729.     public function removeNotificationMail(Emaillog $notificationMail): self
  730.     {
  731.         if ($this->notificationMail->contains($notificationMail)) {
  732.             $this->notificationMail->removeElement($notificationMail);
  733.             // set the owning side to null (unless already changed)
  734.             if ($notificationMail->getUser() === $this) {
  735.                 $notificationMail->setUser(null);
  736.             }
  737.         }
  738.         return $this;
  739.     }
  740.     public function getResetHash(): ?string
  741.     {
  742.         return $this->reset_hash;
  743.     }
  744.     public function setResetHash(?string $reset_hash): self
  745.     {
  746.         $this->reset_hash $reset_hash;
  747.         return $this;
  748.     }
  749.     public function getDateResetCreated(): ?\DateTimeInterface
  750.     {
  751.         return $this->date_reset_created;
  752.     }
  753.     public function setDateResetCreated(?\DateTimeInterface $date_reset_created): self
  754.     {
  755.         $this->date_reset_created $date_reset_created;
  756.         return $this;
  757.     }
  758.     public function getDateLastLogin(): ?\DateTimeInterface
  759.     {
  760.         return $this->date_last_login;
  761.     }
  762.     public function setDateLastLogin(?\DateTimeInterface $date_last_login): self
  763.     {
  764.         $this->date_last_login $date_last_login;
  765.         return $this;
  766.     }
  767.     /**
  768.      * @return Collection|Invoice[]
  769.      */
  770.     public function getInvoice(): Collection
  771.     {
  772.         return $this->invoice;
  773.     }
  774.     public function addInvoice(Invoice $invoice): self
  775.     {
  776.         if (!$this->invoice->contains($invoice)) {
  777.             $this->invoice[] = $invoice;
  778.             $invoice->setUser($this);
  779.         }
  780.         return $this;
  781.     }
  782.     public function removeInvoice(Invoice $invoice): self
  783.     {
  784.         if ($this->invoice->contains($invoice)) {
  785.             $this->invoice->removeElement($invoice);
  786.             // set the owning side to null (unless already changed)
  787.             if ($invoice->getUser() === $this) {
  788.                 $invoice->setUser(null);
  789.             }
  790.         }
  791.         return $this;
  792.     }
  793.     /**
  794.      * @return Collection|Payment[]
  795.      */
  796.     public function getPayment(): Collection
  797.     {
  798.         return $this->payment;
  799.     }
  800.     public function addPayment(Payment $payment): self
  801.     {
  802.         if (!$this->payment->contains($payment)) {
  803.             $this->payment[] = $payment;
  804.             $payment->setUser($this);
  805.         }
  806.         return $this;
  807.     }
  808.     public function removePayment(Payment $payment): self
  809.     {
  810.         if ($this->payment->contains($payment)) {
  811.             $this->payment->removeElement($payment);
  812.             // set the owning side to null (unless already changed)
  813.             if ($payment->getUser() === $this) {
  814.                 $payment->setUser(null);
  815.             }
  816.         }
  817.         return $this;
  818.     }
  819.     public function getIsPublic(): ?bool
  820.     {
  821.         return $this->is_public;
  822.     }
  823.     public function setIsPublic(?bool $is_public): self
  824.     {
  825.         $this->is_public $is_public;
  826.         return $this;
  827.     }
  828.     public function getPublicProfileHash(): ?string
  829.     {
  830.         return $this->public_profile_hash;
  831.     }
  832.     public function setPublicProfileHash(?string $public_profile_hash): self
  833.     {
  834.         $this->public_profile_hash $public_profile_hash;
  835.         return $this;
  836.     }
  837.     public function getAboutMe(): ?string
  838.     {
  839.         return $this->about_me;
  840.     }
  841.     public function setAboutMe(?string $about_me): self
  842.     {
  843.         $this->about_me $about_me;
  844.         return $this;
  845.     }
  846.     /**
  847.      * @return Collection|Crop[]
  848.      */
  849.     public function getCrop(): Collection
  850.     {
  851.         return $this->crop;
  852.     }
  853.     public function addCrop(Crop $crop): self
  854.     {
  855.         if (!$this->crop->contains($crop)) {
  856.             $this->crop[] = $crop;
  857.             $crop->setUser($this);
  858.         }
  859.         return $this;
  860.     }
  861.     public function removeCrop(Crop $crop): self
  862.     {
  863.         if ($this->crop->contains($crop)) {
  864.             $this->crop->removeElement($crop);
  865.             // set the owning side to null (unless already changed)
  866.             if ($crop->getUser() === $this) {
  867.                 $crop->setUser(null);
  868.             }
  869.         }
  870.         return $this;
  871.     }
  872.     /**
  873.      * @return Collection|LoginLog[]
  874.      */
  875.     public function getLoginLog(): Collection
  876.     {
  877.         return $this->loginLog;
  878.     }
  879.     public function addLoginLog(LoginLog $loginLog): self
  880.     {
  881.         if (!$this->loginLog->contains($loginLog)) {
  882.             $this->loginLog[] = $loginLog;
  883.             $loginLog->setUser($this);
  884.         }
  885.         return $this;
  886.     }
  887.     public function removeLoginLog(LoginLog $loginLog): self
  888.     {
  889.         if ($this->loginLog->contains($loginLog)) {
  890.             $this->loginLog->removeElement($loginLog);
  891.             // set the owning side to null (unless already changed)
  892.             if ($loginLog->getUser() === $this) {
  893.                 $loginLog->setUser(null);
  894.             }
  895.         }
  896.         return $this;
  897.     }
  898.     /**
  899.      * @return Collection|VoucherRedemption[]
  900.      */
  901.     public function getVoucherRedemption(): Collection
  902.     {
  903.         return $this->voucherRedemption;
  904.     }
  905.     public function addVoucherRedemption(VoucherRedemption $voucherRedemption): self
  906.     {
  907.         if (!$this->voucherRedemption->contains($voucherRedemption)) {
  908.             $this->voucherRedemption[] = $voucherRedemption;
  909.             $voucherRedemption->setUser($this);
  910.         }
  911.         return $this;
  912.     }
  913.     public function removeVoucherRedemption(VoucherRedemption $voucherRedemption): self
  914.     {
  915.         if ($this->voucherRedemption->contains($voucherRedemption)) {
  916.             $this->voucherRedemption->removeElement($voucherRedemption);
  917.             // set the owning side to null (unless already changed)
  918.             if ($voucherRedemption->getUser() === $this) {
  919.                 $voucherRedemption->setUser(null);
  920.             }
  921.         }
  922.         return $this;
  923.     }
  924.     /**
  925.      * @return Collection|Device[]
  926.      */
  927.     public function getDevice(): Collection
  928.     {
  929.         return $this->device;
  930.     }
  931.     public function addDevice(Device $device): self
  932.     {
  933.         if (!$this->device->contains($device)) {
  934.             $this->device[] = $device;
  935.             $device->setUser($this);
  936.         }
  937.         return $this;
  938.     }
  939.     public function removeDevice(Device $device): self
  940.     {
  941.         if ($this->device->contains($device)) {
  942.             $this->device->removeElement($device);
  943.             // set the owning side to null (unless already changed)
  944.             if ($device->getUser() === $this) {
  945.                 $device->setUser(null);
  946.             }
  947.         }
  948.         return $this;
  949.     }
  950.     public function getDateDisabled(): ?\DateTimeInterface
  951.     {
  952.         return $this->date_disabled;
  953.     }
  954.     public function setDateDisabled(?\DateTimeInterface $date_disabled): self
  955.     {
  956.         $this->date_disabled $date_disabled;
  957.         return $this;
  958.     }
  959.     /**
  960.      * @return Collection|Cropaction[]
  961.      */
  962.     public function getCropaction(): Collection
  963.     {
  964.         return $this->cropaction;
  965.     }
  966.     public function addCropaction(Cropaction $cropaction): self
  967.     {
  968.         if (!$this->cropaction->contains($cropaction)) {
  969.             $this->cropaction[] = $cropaction;
  970.             $cropaction->setUser($this);
  971.         }
  972.         return $this;
  973.     }
  974.     public function removeCropaction(Cropaction $cropaction): self
  975.     {
  976.         if ($this->cropaction->contains($cropaction)) {
  977.             $this->cropaction->removeElement($cropaction);
  978.             // set the owning side to null (unless already changed)
  979.             if ($cropaction->getUser() === $this) {
  980.                 $cropaction->setUser(null);
  981.             }
  982.         }
  983.         return $this;
  984.     }
  985.     /**
  986.      * @return Collection|Survey[]
  987.      */
  988.     public function getSurvey(): Collection
  989.     {
  990.         return $this->survey;
  991.     }
  992.     public function addSurvey(Survey $survey): self
  993.     {
  994.         if (!$this->survey->contains($survey)) {
  995.             $this->survey[] = $survey;
  996.             $survey->setUser($this);
  997.         }
  998.         return $this;
  999.     }
  1000.     public function removeSurvey(Survey $survey): self
  1001.     {
  1002.         if ($this->survey->contains($survey)) {
  1003.             $this->survey->removeElement($survey);
  1004.             // set the owning side to null (unless already changed)
  1005.             if ($survey->getUser() === $this) {
  1006.                 $survey->setUser(null);
  1007.             }
  1008.         }
  1009.         return $this;
  1010.     }
  1011.     /**
  1012.      * @return Collection|Post[]
  1013.      */
  1014.     public function getPost(): Collection
  1015.     {
  1016.         return $this->post;
  1017.     }
  1018.     public function addPost(Post $post): self
  1019.     {
  1020.         if (!$this->post->contains($post)) {
  1021.             $this->post[] = $post;
  1022.             $post->setUser($this);
  1023.         }
  1024.         return $this;
  1025.     }
  1026.     public function removePost(Post $post): self
  1027.     {
  1028.         if ($this->post->contains($post)) {
  1029.             $this->post->removeElement($post);
  1030.             // set the owning side to null (unless already changed)
  1031.             if ($post->getUser() === $this) {
  1032.                 $post->setUser(null);
  1033.             }
  1034.         }
  1035.         return $this;
  1036.     }
  1037.     /**
  1038.      * @return Collection|PostComment[]
  1039.      */
  1040.     public function getPostComment(): Collection
  1041.     {
  1042.         return $this->postComment;
  1043.     }
  1044.     public function addPostComment(PostComment $postComment): self
  1045.     {
  1046.         if (!$this->postComment->contains($postComment)) {
  1047.             $this->postComment[] = $postComment;
  1048.             $postComment->setUser($this);
  1049.         }
  1050.         return $this;
  1051.     }
  1052.     public function removePostComment(PostComment $postComment): self
  1053.     {
  1054.         if ($this->postComment->contains($postComment)) {
  1055.             $this->postComment->removeElement($postComment);
  1056.             // set the owning side to null (unless already changed)
  1057.             if ($postComment->getUser() === $this) {
  1058.                 $postComment->setUser(null);
  1059.             }
  1060.         }
  1061.         return $this;
  1062.     }
  1063.     /**
  1064.      * @return Collection|PostBookmark[]
  1065.      */
  1066.     public function getPostBookmark(): Collection
  1067.     {
  1068.         return $this->postBookmark;
  1069.     }
  1070.     public function addPostBookmark(PostBookmark $postBookmark): self
  1071.     {
  1072.         if (!$this->postBookmark->contains($postBookmark)) {
  1073.             $this->postBookmark[] = $postBookmark;
  1074.             $postBookmark->setUser($this);
  1075.         }
  1076.         return $this;
  1077.     }
  1078.     public function removePostBookmark(PostBookmark $postBookmark): self
  1079.     {
  1080.         if ($this->postBookmark->contains($postBookmark)) {
  1081.             $this->postBookmark->removeElement($postBookmark);
  1082.             // set the owning side to null (unless already changed)
  1083.             if ($postBookmark->getUser() === $this) {
  1084.                 $postBookmark->setUser(null);
  1085.             }
  1086.         }
  1087.         return $this;
  1088.     }
  1089.     /**
  1090.      * @return Collection|Rating[]
  1091.      */
  1092.     public function getRating(): Collection
  1093.     {
  1094.         return $this->rating;
  1095.     }
  1096.     public function addRating(Rating $rating): self
  1097.     {
  1098.         if (!$this->rating->contains($rating)) {
  1099.             $this->rating[] = $rating;
  1100.             $rating->setUser($this);
  1101.         }
  1102.         return $this;
  1103.     }
  1104.     public function removeRating(Rating $rating): self
  1105.     {
  1106.         if ($this->rating->contains($rating)) {
  1107.             $this->rating->removeElement($rating);
  1108.             // set the owning side to null (unless already changed)
  1109.             if ($rating->getUser() === $this) {
  1110.                 $rating->setUser(null);
  1111.             }
  1112.         }
  1113.         return $this;
  1114.     }
  1115.     public function getProfile($skipTranslation false): ?array
  1116.     {
  1117.         $profile $this->profile;
  1118.         if (!$skipTranslation && isset($profile['descriptionTranslation']) &&
  1119.             $this->getCurrentLocale() !== $this->getDefaultLocale() &&
  1120.             isset($profile['descriptionTranslation'][$this->getCurrentLocale()])) {
  1121.             $profile['originalDescription'] = $profile['description'];
  1122.             $profile['description'] = $profile['descriptionTranslation'][$this->getCurrentLocale()];
  1123.         }
  1124.         return $profile;
  1125.     }
  1126.     public function setProfile(?array $profile): self
  1127.     {
  1128.         $this->profile $profile;
  1129.         return $this;
  1130.     }
  1131.     public function getIsProfileTranslated(): bool
  1132.     {
  1133.         return isset($this->profile['descriptionTranslation']) &&
  1134.             $this->getCurrentLocale() !== $this->getDefaultLocale() &&
  1135.             isset($this->profile['descriptionTranslation'][$this->getCurrentLocale()]);
  1136.     }
  1137.     /**
  1138.      * @return Collection|Appsurvey[]
  1139.      */
  1140.     public function getAppsurvey(): Collection
  1141.     {
  1142.         return $this->appsurvey;
  1143.     }
  1144.     public function addAppsurvey(Appsurvey $appsurvey): self
  1145.     {
  1146.         if (!$this->appsurvey->contains($appsurvey)) {
  1147.             $this->appsurvey[] = $appsurvey;
  1148.             $appsurvey->setUser($this);
  1149.         }
  1150.         return $this;
  1151.     }
  1152.     public function removeAppsurvey(Appsurvey $appsurvey): self
  1153.     {
  1154.         if ($this->appsurvey->contains($appsurvey)) {
  1155.             $this->appsurvey->removeElement($appsurvey);
  1156.             // set the owning side to null (unless already changed)
  1157.             if ($appsurvey->getUser() === $this) {
  1158.                 $appsurvey->setUser(null);
  1159.             }
  1160.         }
  1161.         return $this;
  1162.     }
  1163.     /**
  1164.      * @return Collection|PushNotification[]
  1165.      */
  1166.     public function getPushNotification(): Collection
  1167.     {
  1168.         return $this->pushNotification;
  1169.     }
  1170.     public function addPushNotification(PushNotification $pushNotification): self
  1171.     {
  1172.         if (!$this->pushNotification->contains($pushNotification)) {
  1173.             $this->pushNotification[] = $pushNotification;
  1174.             $pushNotification->setUser($this);
  1175.         }
  1176.         return $this;
  1177.     }
  1178.     public function removePushNotification(PushNotification $pushNotification): self
  1179.     {
  1180.         if ($this->pushNotification->contains($pushNotification)) {
  1181.             $this->pushNotification->removeElement($pushNotification);
  1182.             // set the owning side to null (unless already changed)
  1183.             if ($pushNotification->getUser() === $this) {
  1184.                 $pushNotification->setUser(null);
  1185.             }
  1186.         }
  1187.         return $this;
  1188.     }
  1189.     public function getLoginCount(): ?int
  1190.     {
  1191.         return $this->login_count;
  1192.     }
  1193.     public function setLoginCount(?int $login_count): self
  1194.     {
  1195.         $this->login_count $login_count;
  1196.         return $this;
  1197.     }
  1198.     /**
  1199.      * @return Collection|Image[]
  1200.      */
  1201.     public function getImage(): Collection
  1202.     {
  1203.         return $this->image;
  1204.     }
  1205.     public function addImage(Image $image): self
  1206.     {
  1207.         if (!$this->image->contains($image)) {
  1208.             $this->image[] = $image;
  1209.             $image->setUser($this);
  1210.         }
  1211.         return $this;
  1212.     }
  1213.     public function removeImage(Image $image): self
  1214.     {
  1215.         if ($this->image->removeElement($image)) {
  1216.             // set the owning side to null (unless already changed)
  1217.             if ($image->getUser() === $this) {
  1218.                 $image->setUser(null);
  1219.             }
  1220.         }
  1221.         return $this;
  1222.     }
  1223.     /**
  1224.      * @return Collection|CropEdit[]
  1225.      */
  1226.     public function getCropEdit(): Collection
  1227.     {
  1228.         return $this->cropEdit;
  1229.     }
  1230.     public function addCropEdit(CropEdit $cropEdit): self
  1231.     {
  1232.         if (!$this->cropEdit->contains($cropEdit)) {
  1233.             $this->cropEdit[] = $cropEdit;
  1234.             $cropEdit->setUser($this);
  1235.         }
  1236.         return $this;
  1237.     }
  1238.     public function removeCropEdit(CropEdit $cropEdit): self
  1239.     {
  1240.         if ($this->cropEdit->removeElement($cropEdit)) {
  1241.             // set the owning side to null (unless already changed)
  1242.             if ($cropEdit->getUser() === $this) {
  1243.                 $cropEdit->setUser(null);
  1244.             }
  1245.         }
  1246.         return $this;
  1247.     }
  1248.     /**
  1249.      * @return Collection|CropRating[]
  1250.      */
  1251.     public function getCropRating(): Collection
  1252.     {
  1253.         return $this->cropRating;
  1254.     }
  1255.     public function addCropRating(CropRating $cropRating): self
  1256.     {
  1257.         if (!$this->cropRating->contains($cropRating)) {
  1258.             $this->cropRating[] = $cropRating;
  1259.             $cropRating->setUser($this);
  1260.         }
  1261.         return $this;
  1262.     }
  1263.     public function removeCropRating(CropRating $cropRating): self
  1264.     {
  1265.         if ($this->cropRating->removeElement($cropRating)) {
  1266.             // set the owning side to null (unless already changed)
  1267.             if ($cropRating->getUser() === $this) {
  1268.                 $cropRating->setUser(null);
  1269.             }
  1270.         }
  1271.         return $this;
  1272.     }
  1273.     /**
  1274.      * @return Collection|CartItem[]
  1275.      */
  1276.     public function getCartItem(): Collection
  1277.     {
  1278.         return $this->cartItem;
  1279.     }
  1280.     public function addCartItem(CartItem $cartItem): self
  1281.     {
  1282.         if (!$this->cartItem->contains($cartItem)) {
  1283.             $this->cartItem[] = $cartItem;
  1284.             $cartItem->setUser($this);
  1285.         }
  1286.         return $this;
  1287.     }
  1288.     public function removeCartItem(CartItem $cartItem): self
  1289.     {
  1290.         if ($this->cartItem->removeElement($cartItem)) {
  1291.             // set the owning side to null (unless already changed)
  1292.             if ($cartItem->getUser() === $this) {
  1293.                 $cartItem->setUser(null);
  1294.             }
  1295.         }
  1296.         return $this;
  1297.     }
  1298.     /**
  1299.      * @return Collection|Garden[]
  1300.      */
  1301.     public function getGardens(): Collection
  1302.     {
  1303.         return $this->gardens;
  1304.     }
  1305.     public function addGarden(Garden $garden): self
  1306.     {
  1307.         if (!$this->gardens->contains($garden)) {
  1308.             $this->gardens[] = $garden;
  1309.             $garden->setUser($this);
  1310.         }
  1311.         return $this;
  1312.     }
  1313.     public function removeGarden(Garden $garden): self
  1314.     {
  1315.         if ($this->gardens->removeElement($garden)) {
  1316.             // set the owning side to null (unless already changed)
  1317.             if ($garden->getUser() === $this) {
  1318.                 $garden->setUser(null);
  1319.             }
  1320.         }
  1321.         return $this;
  1322.     }
  1323.     public function isPaidAccount(): bool
  1324.     {
  1325.         $paidTypes = [
  1326.             AccountType::Paid->value,
  1327.             AccountType::Plus->value,
  1328.             AccountType::Pro->value
  1329.         ];
  1330.         return in_array($this->account_type$paidTypes);
  1331.     }
  1332.     public function isValidPaidAccount(): bool
  1333.     {
  1334.         if (!$this->isPaidAccount()) {
  1335.             return false;
  1336.         }
  1337.         if ($this->isLifetimePayment()) {
  1338.             return true;
  1339.         }
  1340.         $paymentData $this->getPaymentData();
  1341.         $validUntil = (new \DateTime($paymentData[PaymentDataConstants::VALID_UNTIL]))->setTime(235959);
  1342.         $today = (new \DateTime())->setTime(000);
  1343.         return $validUntil >= $today;
  1344.     }
  1345.     public function isReferralActivated(): bool
  1346.     {
  1347.         $type $this->getPaymentDataField(PaymentDataConstants::TYPE);
  1348.         return isset($type) && $type === PaymentType::Referral->value;
  1349.     }
  1350.     public function isLifetimePayment(): bool
  1351.     {
  1352.         $type $this->getPaymentDataField(PaymentDataConstants::TYPE);
  1353.         return isset($type) && $type === PaymentType::Lifetime->value;
  1354.     }
  1355.     public function isSubscriptionTrialPayment(): bool
  1356.     {
  1357.         $trialEnd $this->getTrialEndDate();
  1358.         if ($trialEnd === null) {
  1359.             return false;
  1360.         }
  1361.         $today = (new \DateTime())->setTime(235959);
  1362.         return $today $trialEnd;
  1363.     }
  1364.     public function isInAppPayment(): bool
  1365.     {
  1366.         $paymentData $this->getPaymentData();
  1367.         return isset($paymentData[PaymentDataConstants::IN_APP]);
  1368.     }
  1369.     public function getTrialEndDate($format false): ?\DateTime
  1370.     {
  1371.         if (!$this->isPaidAccount() || $this->isLifetimePayment()) {
  1372.             return null;
  1373.         }
  1374.         $start $this->getPaymentStartDate();
  1375.         if ($start === null) {
  1376.             return null;
  1377.         }
  1378.         return (clone $start)->modify('+7 days')->setTime(235959);
  1379.     }
  1380.     public function getPaymentStartDate(): ?\DateTime
  1381.     {
  1382.         $start null;
  1383.         $paymentData $this->getPaymentData();
  1384.         if (isset($paymentData[PaymentDataConstants::START_DATE])) {
  1385.             $start = (new \DateTime($paymentData[PaymentDataConstants::START_DATE]))->setTime(00);
  1386.         } elseif (isset($paymentData[PaymentDataConstants::VALID_FROM])) {
  1387.             $start = (new \DateTime($paymentData[PaymentDataConstants::VALID_FROM]))->setTime(00);
  1388.         }
  1389.         return $start;
  1390.     }
  1391.     public function getSubscriptionStatus(): string
  1392.     {
  1393.         $paymentData $this->getPaymentData();
  1394.         if (empty($paymentData) || !isset($paymentData[PaymentDataConstants::TYPE])) {
  1395.             return SubscriptionStatus::None->value;
  1396.         }
  1397.         if ($paymentData[PaymentDataConstants::TYPE] === 'referral' ||
  1398.             $paymentData[PaymentDataConstants::TYPE] === 'voucher') {
  1399.             return SubscriptionStatus::None->value;
  1400.         }
  1401.         if (isset($paymentData[PaymentDataConstants::IN_APP])) {
  1402.             // iap status can be: Active, Cancelled, Expired -> we only map to active or cancelled
  1403.             // if no iap status is set, the subscription is active too
  1404.             if ((!isset($paymentData[PaymentDataConstants::IAP_STATUS]) && $this->isValidPaidAccount())
  1405.                 || (isset($paymentData[PaymentDataConstants::IAP_STATUS]) &&
  1406.                     $paymentData[PaymentDataConstants::IAP_STATUS] === PaymentDataEnum::IapStatusActive->value)) {
  1407.                 return SubscriptionStatus::Active->value;
  1408.             }
  1409.             return SubscriptionStatus::Cancelled->value;
  1410.         } else {
  1411.             if (isset($paymentData[PaymentDataConstants::STATE])) {
  1412.                 if ($paymentData[PaymentDataConstants::STATE] === PaymentDataEnum::IapStatusActive->value) {
  1413.                     return SubscriptionStatus::Active->value;
  1414.                 }
  1415.                 return SubscriptionStatus::Cancelled->value;
  1416.             }
  1417.         }
  1418.         return SubscriptionStatus::None->value;
  1419.     }
  1420.     public function getSubscriptionId(): ?string
  1421.     {
  1422.         $paymentData $this->getPaymentData();
  1423.         if (isset($paymentData[PaymentDataConstants::AGREEMENT_ID])) {
  1424.             return $paymentData[PaymentDataConstants::AGREEMENT_ID];
  1425.         }
  1426.         return null;
  1427.     }
  1428.     public function getPaddleSubscriptionId(): ?string
  1429.     {
  1430.         $paymentData $this->getPaymentData();
  1431.         if (isset($paymentData[PaymentDataConstants::PADDLE_ID])) {
  1432.             return $paymentData[PaymentDataConstants::PADDLE_ID];
  1433.         }
  1434.         return null;
  1435.     }
  1436.     public function getSubscriptionType(): ?string
  1437.     {
  1438.         $paymentData $this->getPaymentData();
  1439.         $locale $this->getLocale();
  1440.         $subscriptionType '';
  1441.         if (isset($paymentData[PaymentDataConstants::TYPE])) {
  1442.             if ($locale === 'en') {
  1443.                 $subscriptionType $paymentData[PaymentDataConstants::TYPE] === 'monthly' 'monthly subscription' 'yearly subscription';
  1444.             } else {
  1445.                 $subscriptionType $paymentData[PaymentDataConstants::TYPE] === 'monthly' 'Monatsabo' 'Jahresabo';
  1446.             }
  1447.         }
  1448.         return $subscriptionType;
  1449.     }
  1450.     public function getSubscriptionTypeEnum(): ?string
  1451.     {
  1452.         $paymentData $this->getPaymentData();
  1453.         if (isset($paymentData[PaymentDataConstants::TYPE]) &&
  1454.             isset($paymentData[PaymentDataConstants::TYPE]) !== null) {
  1455.             return $paymentData[PaymentDataConstants::TYPE];
  1456.         }
  1457.         return 'none';
  1458.     }
  1459.     public function getPaymentType(): ?string
  1460.     {
  1461.         $paymentData $this->getPaymentData();
  1462.         if ($this->getSubscriptionTypeEnum() === 'voucher') {
  1463.             return 'voucher';
  1464.         }
  1465.         if (isset($paymentData[PaymentDataConstants::IN_APP])) {
  1466.             // todo: in-app google / apple
  1467.             $payments $this->getPayment();
  1468.             if ($payments->count() === 0) {
  1469.                 return 'in-app';
  1470.             } else {
  1471.                 /** @var Payment $lastPayment */
  1472.                 $lastPayment $payments->last();
  1473.                 return 'in-app-' $lastPayment->getProvider();
  1474.             }
  1475.         }
  1476.         if (isset($paymentData[PaymentDataConstants::AGREEMENT_ID])) {
  1477.             return 'paypal';
  1478.         }
  1479.         return 'none';
  1480.     }
  1481.     public function setSetting($settingName$settingValue): void
  1482.     {
  1483.         $settings $this->settings;
  1484.         if ($settingName === SettingConstants::SOURCE) {
  1485.             $originalSettingValue $settingValue;
  1486.             $settings[SettingConstants::SOURCE_RAW] = $originalSettingValue;
  1487.             // todo: if setting string contains utm_content with json data, then decode and decrypt with fb key to attribute
  1488.             if (str_contains($originalSettingValue'utm_content')) {
  1489.                 $result MetaAttributionHelper::extractData($originalSettingValue);
  1490.                 if ($result !== null) {
  1491.                     $settings[SettingConstants::SOURCE_ATTRIBUTION] = $result;
  1492.                 }
  1493.             }
  1494.             // limit setting value to 255 chars
  1495.             $settingValue substr($settingValue0254);
  1496.         }
  1497.         $settings[$settingName] = $settingValue;
  1498.         $this->setSettings($settings);
  1499.     }
  1500.     public function getSetting($settingName)
  1501.     {
  1502.         return $this->settings[$settingName] ?? null;
  1503.     }
  1504.     /**
  1505.      * @return Collection|CommentLike[]
  1506.      */
  1507.     public function getCommentLikes(): Collection
  1508.     {
  1509.         return $this->commentLikes;
  1510.     }
  1511.     public function addCommentLike(CommentLike $commentLike): self
  1512.     {
  1513.         if (!$this->commentLikes->contains($commentLike)) {
  1514.             $this->commentLikes[] = $commentLike;
  1515.             $commentLike->setUser($this);
  1516.         }
  1517.         return $this;
  1518.     }
  1519.     public function removeCommentLike(CommentLike $commentLike): self
  1520.     {
  1521.         if ($this->commentLikes->removeElement($commentLike)) {
  1522.             // set the owning side to null (unless already changed)
  1523.             if ($commentLike->getUser() === $this) {
  1524.                 $commentLike->setUser(null);
  1525.             }
  1526.         }
  1527.         return $this;
  1528.     }
  1529.     /**
  1530.      * @return Collection|Notification[]
  1531.      */
  1532.     public function getNotifications(): Collection
  1533.     {
  1534.         return $this->notifications;
  1535.     }
  1536.     public function addNotification(Notification $notification): self
  1537.     {
  1538.         if (!$this->notifications->contains($notification)) {
  1539.             $this->notifications[] = $notification;
  1540.             $notification->setUser($this);
  1541.         }
  1542.         return $this;
  1543.     }
  1544.     public function removeNotification(Notification $notification): self
  1545.     {
  1546.         if ($this->notifications->removeElement($notification)) {
  1547.             // set the owning side to null (unless already changed)
  1548.             if ($notification->getUser() === $this) {
  1549.                 $notification->setUser(null);
  1550.             }
  1551.         }
  1552.         return $this;
  1553.     }
  1554.     public function isModerator(): bool
  1555.     {
  1556.         // super moderators always have moderator privileges too
  1557.         if ($this->isSuperModerator()) {
  1558.             return true;
  1559.         }
  1560.         $settings $this->getSettings();
  1561.         return isset($settings[SettingConstants::IS_MODERATOR]) && $settings[SettingConstants::IS_MODERATOR] === true;
  1562.     }
  1563.     public function isSuperModerator(): bool
  1564.     {
  1565.         $settings $this->getSettings();
  1566.         return isset($settings[SettingConstants::IS_SUPER_MODERATOR]) && $settings[SettingConstants::IS_SUPER_MODERATOR] === true;
  1567.     }
  1568.     /**
  1569.      * @return Collection|Nps[]
  1570.      */
  1571.     public function getNps(): Collection
  1572.     {
  1573.         return $this->nps;
  1574.     }
  1575.     public function addNp(Nps $np): self
  1576.     {
  1577.         if (!$this->nps->contains($np)) {
  1578.             $this->nps[] = $np;
  1579.             $np->setUser($this);
  1580.         }
  1581.         return $this;
  1582.     }
  1583.     public function removeNp(Nps $np): self
  1584.     {
  1585.         if ($this->nps->removeElement($np)) {
  1586.             // set the owning side to null (unless already changed)
  1587.             if ($np->getUser() === $this) {
  1588.                 $np->setUser(null);
  1589.             }
  1590.         }
  1591.         return $this;
  1592.     }
  1593.     /**
  1594.      * @return Collection<int, UserConnection>
  1595.      */
  1596.     public function getUserConnections(): Collection
  1597.     {
  1598.         return $this->userConnections;
  1599.     }
  1600.     public function addUserConnection(UserConnection $userConnection): self
  1601.     {
  1602.         if (!$this->userConnections->contains($userConnection)) {
  1603.             $this->userConnections[] = $userConnection;
  1604.             $userConnection->setUser($this);
  1605.         }
  1606.         return $this;
  1607.     }
  1608.     public function removeUserConnection(UserConnection $userConnection): self
  1609.     {
  1610.         if ($this->userConnections->removeElement($userConnection)) {
  1611.             // set the owning side to null (unless already changed)
  1612.             if ($userConnection->getUser() === $this) {
  1613.                 $userConnection->setUser(null);
  1614.             }
  1615.         }
  1616.         return $this;
  1617.     }
  1618.     public function getDisplayName(): string
  1619.     {
  1620.         if ($this->nickname !== null && trim($this->nickname) !== '') {
  1621.             return $this->nickname;
  1622.         }
  1623.         $name $this->firstname;
  1624.         if (!empty($this->lastname)) {
  1625.             $name .= ' ' mb_substr($this->lastname01) . '.';
  1626.         }
  1627.         return $name ?? '';
  1628.     }
  1629.     /**
  1630.      * @return Collection<int, Reminder>
  1631.      */
  1632.     public function getReminders(): Collection
  1633.     {
  1634.         return $this->reminders;
  1635.     }
  1636.     public function addReminder(Reminder $reminder): self
  1637.     {
  1638.         if (!$this->reminders->contains($reminder)) {
  1639.             $this->reminders[] = $reminder;
  1640.             $reminder->setUser($this);
  1641.         }
  1642.         return $this;
  1643.     }
  1644.     public function removeReminder(Reminder $reminder): self
  1645.     {
  1646.         if ($this->reminders->removeElement($reminder)) {
  1647.             // set the owning side to null (unless already changed)
  1648.             if ($reminder->getUser() === $this) {
  1649.                 $reminder->setUser(null);
  1650.             }
  1651.         }
  1652.         return $this;
  1653.     }
  1654.     public function setImageDataUri(string $uri): self
  1655.     {
  1656.         $this->imageDataUri $uri;
  1657.         return $this;
  1658.     }
  1659.     public function getImageDataUri(): string
  1660.     {
  1661.         return $this->imageDataUri;
  1662.     }
  1663.     /**
  1664.      * @return Collection<int, ProfitwellUser>
  1665.      */
  1666.     public function getProfitwellUsers(): Collection
  1667.     {
  1668.         return $this->profitwellUsers;
  1669.     }
  1670.     public function addProfitwellUser(ProfitwellUser $profitwellUser): self
  1671.     {
  1672.         if (!$this->profitwellUsers->contains($profitwellUser)) {
  1673.             $this->profitwellUsers[] = $profitwellUser;
  1674.             $profitwellUser->setUser($this);
  1675.         }
  1676.         return $this;
  1677.     }
  1678.     public function removeProfitwellUser(ProfitwellUser $profitwellUser): self
  1679.     {
  1680.         if ($this->profitwellUsers->removeElement($profitwellUser)) {
  1681.             // set the owning side to null (unless already changed)
  1682.             if ($profitwellUser->getUser() === $this) {
  1683.                 $profitwellUser->setUser(null);
  1684.             }
  1685.         }
  1686.         return $this;
  1687.     }
  1688.     /**
  1689.      * @return Collection<int, Template>
  1690.      */
  1691.     public function getTemplates(): Collection
  1692.     {
  1693.         return $this->templates;
  1694.     }
  1695.     public function addTemplate(Template $template): self
  1696.     {
  1697.         if (!$this->templates->contains($template)) {
  1698.             $this->templates[] = $template;
  1699.             $template->setCreatedByUser($this);
  1700.         }
  1701.         return $this;
  1702.     }
  1703.     public function removeTemplate(Template $template): self
  1704.     {
  1705.         if ($this->templates->removeElement($template)) {
  1706.             // set the owning side to null (unless already changed)
  1707.             if ($template->getCreatedByUser() === $this) {
  1708.                 $template->setCreatedByUser(null);
  1709.             }
  1710.         }
  1711.         return $this;
  1712.     }
  1713.     public function updateMentionTag(): self
  1714.     {
  1715.         $transformation = [" " => "_""-" => "_""#" => """@" => ""];
  1716.         if (!empty($this->getNickname())) {
  1717.             $sanitized strtr($this->getNickname(), $transformation);
  1718.             $this->setSetting('mentionTag'$sanitized);
  1719.         }
  1720.         return $this;
  1721.     }
  1722.     /**
  1723.      * @return Collection<int, FavoriteTemplate>
  1724.      */
  1725.     public function getFavoriteTemplates(): Collection
  1726.     {
  1727.         return $this->favoriteTemplates;
  1728.     }
  1729.     public function addFavoriteTemplate(FavoriteTemplate $favoriteTemplate): self
  1730.     {
  1731.         if (!$this->favoriteTemplates->contains($favoriteTemplate)) {
  1732.             $this->favoriteTemplates[] = $favoriteTemplate;
  1733.             $favoriteTemplate->setUser($this);
  1734.         }
  1735.         return $this;
  1736.     }
  1737.     public function removeFavoriteTemplate(FavoriteTemplate $favoriteTemplate): self
  1738.     {
  1739.         if ($this->favoriteTemplates->removeElement($favoriteTemplate)) {
  1740.             // set the owning side to null (unless already changed)
  1741.             if ($favoriteTemplate->getUser() === $this) {
  1742.                 $favoriteTemplate->setUser(null);
  1743.             }
  1744.         }
  1745.         return $this;
  1746.     }
  1747.     /**
  1748.      * @return Collection<int, TemplateUsage>
  1749.      */
  1750.     public function getTemplateUsages(): Collection
  1751.     {
  1752.         return $this->templateUsages;
  1753.     }
  1754.     public function addTemplateUsage(TemplateUsage $templateUsage): self
  1755.     {
  1756.         if (!$this->templateUsages->contains($templateUsage)) {
  1757.             $this->templateUsages[] = $templateUsage;
  1758.             $templateUsage->setUser($this);
  1759.         }
  1760.         return $this;
  1761.     }
  1762.     public function removeTemplateUsage(TemplateUsage $templateUsage): self
  1763.     {
  1764.         if ($this->templateUsages->removeElement($templateUsage)) {
  1765.             // set the owning side to null (unless already changed)
  1766.             if ($templateUsage->getUser() === $this) {
  1767.                 $templateUsage->setUser(null);
  1768.             }
  1769.         }
  1770.         return $this;
  1771.     }
  1772.     /**
  1773.      * @return Collection<int, ObjectComment>
  1774.      */
  1775.     public function getObjectComments(): Collection
  1776.     {
  1777.         return $this->objectComments;
  1778.     }
  1779.     public function addObjectComment(ObjectComment $objectComment): self
  1780.     {
  1781.         if (!$this->objectComments->contains($objectComment)) {
  1782.             $this->objectComments[] = $objectComment;
  1783.             $objectComment->setUser($this);
  1784.         }
  1785.         return $this;
  1786.     }
  1787.     public function removeObjectComment(ObjectComment $objectComment): self
  1788.     {
  1789.         if ($this->objectComments->removeElement($objectComment)) {
  1790.             // set the owning side to null (unless already changed)
  1791.             if ($objectComment->getUser() === $this) {
  1792.                 $objectComment->setUser(null);
  1793.             }
  1794.         }
  1795.         return $this;
  1796.     }
  1797.     /**
  1798.      * @return Collection<int, PreferencesToken>
  1799.      */
  1800.     public function getPreferencesTokens(): Collection
  1801.     {
  1802.         return $this->preferencesTokens;
  1803.     }
  1804.     public function addPreferencesToken(PreferencesToken $preferencesToken): self
  1805.     {
  1806.         if (!$this->preferencesTokens->contains($preferencesToken)) {
  1807.             $this->preferencesTokens[] = $preferencesToken;
  1808.             $preferencesToken->setUser($this);
  1809.         }
  1810.         return $this;
  1811.     }
  1812.     public function removePreferencesToken(PreferencesToken $preferencesToken): self
  1813.     {
  1814.         if ($this->preferencesTokens->removeElement($preferencesToken)) {
  1815.             // set the owning side to null (unless already changed)
  1816.             if ($preferencesToken->getUser() === $this) {
  1817.                 $preferencesToken->setUser(null);
  1818.             }
  1819.         }
  1820.         return $this;
  1821.     }
  1822.     /**
  1823.      * @return Collection<int, Usercontent>
  1824.      */
  1825.     public function getUsercontents(): Collection
  1826.     {
  1827.         return $this->usercontents;
  1828.     }
  1829.     public function addUsercontent(Usercontent $usercontent): self
  1830.     {
  1831.         if (!$this->usercontents->contains($usercontent)) {
  1832.             $this->usercontents[] = $usercontent;
  1833.             $usercontent->setUser($this);
  1834.         }
  1835.         return $this;
  1836.     }
  1837.     public function removeUsercontent(Usercontent $usercontent): self
  1838.     {
  1839.         if ($this->usercontents->removeElement($usercontent)) {
  1840.             // set the owning side to null (unless already changed)
  1841.             if ($usercontent->getUser() === $this) {
  1842.                 $usercontent->setUser(null);
  1843.             }
  1844.         }
  1845.         return $this;
  1846.     }
  1847.     /**
  1848.      * @return Collection<int, TagConnection>
  1849.      */
  1850.     public function getTagConnections(): Collection
  1851.     {
  1852.         return $this->tagConnections;
  1853.     }
  1854.     public function addTagConnection(TagConnection $tagConnection): self
  1855.     {
  1856.         if (!$this->tagConnections->contains($tagConnection)) {
  1857.             $this->tagConnections[] = $tagConnection;
  1858.             $tagConnection->setUser($this);
  1859.         }
  1860.         return $this;
  1861.     }
  1862.     public function removeTagConnection(TagConnection $tagConnection): self
  1863.     {
  1864.         if ($this->tagConnections->removeElement($tagConnection)) {
  1865.             // set the owning side to null (unless already changed)
  1866.             if ($tagConnection->getUser() === $this) {
  1867.                 $tagConnection->setUser(null);
  1868.             }
  1869.         }
  1870.         return $this;
  1871.     }
  1872.     /**
  1873.      * @return Collection<int, Croplist>
  1874.      */
  1875.     public function getCropLists(): Collection
  1876.     {
  1877.         return $this->cropLists;
  1878.     }
  1879.     public function addCropList(Croplist $cropList): self
  1880.     {
  1881.         if (!$this->cropLists->contains($cropList)) {
  1882.             $this->cropLists->add($cropList);
  1883.             $cropList->setUser($this);
  1884.         }
  1885.         return $this;
  1886.     }
  1887.     public function removeCropList(Croplist $cropList): self
  1888.     {
  1889.         if ($this->cropLists->removeElement($cropList)) {
  1890.             // set the owning side to null (unless already changed)
  1891.             if ($cropList->getUser() === $this) {
  1892.                 $cropList->setUser(null);
  1893.             }
  1894.         }
  1895.         return $this;
  1896.     }
  1897.     public function getLocale(): ?string
  1898.     {
  1899.         return $this->locale;
  1900.     }
  1901.     public function setLocale(?string $locale): static
  1902.     {
  1903.         $this->locale $locale;
  1904.         return $this;
  1905.     }
  1906.     /**
  1907.      * @return Collection<int, CancellationSurvey>
  1908.      */
  1909.     public function getCancellationSurveys(): Collection
  1910.     {
  1911.         return $this->cancellationSurveys;
  1912.     }
  1913.     public function addCancellationSurvey(CancellationSurvey $cancellationSurvey): static
  1914.     {
  1915.         if (!$this->cancellationSurveys->contains($cancellationSurvey)) {
  1916.             $this->cancellationSurveys->add($cancellationSurvey);
  1917.             $cancellationSurvey->setUser($this);
  1918.         }
  1919.         return $this;
  1920.     }
  1921.     public function removeCancellationSurvey(CancellationSurvey $cancellationSurvey): static
  1922.     {
  1923.         if ($this->cancellationSurveys->removeElement($cancellationSurvey)) {
  1924.             // set the owning side to null (unless already changed)
  1925.             if ($cancellationSurvey->getUser() === $this) {
  1926.                 $cancellationSurvey->setUser(null);
  1927.             }
  1928.         }
  1929.         return $this;
  1930.     }
  1931.     /**
  1932.      * @return Collection<int, ModerationNotification>
  1933.      */
  1934.     public function getModerationNotifications(): Collection
  1935.     {
  1936.         return $this->moderationNotifications;
  1937.     }
  1938.     public function addModerationNotification(ModerationNotification $moderationNotification): static
  1939.     {
  1940.         if (!$this->moderationNotifications->contains($moderationNotification)) {
  1941.             $this->moderationNotifications->add($moderationNotification);
  1942.             $moderationNotification->setUser($this);
  1943.         }
  1944.         return $this;
  1945.     }
  1946.     public function removeModerationNotification(ModerationNotification $moderationNotification): static
  1947.     {
  1948.         if ($this->moderationNotifications->removeElement($moderationNotification)) {
  1949.             // set the owning side to null (unless already changed)
  1950.             if ($moderationNotification->getUser() === $this) {
  1951.                 $moderationNotification->setUser(null);
  1952.             }
  1953.         }
  1954.         return $this;
  1955.     }
  1956.     public function getTest(): ?string
  1957.     {
  1958.         return $this->test;
  1959.     }
  1960.     public function setTest(string $test): static
  1961.     {
  1962.         $this->test $test;
  1963.         return $this;
  1964.     }
  1965.     public function getClimateSettings(): ?array
  1966.     {
  1967.         return $this->climate_settings;
  1968.     }
  1969.     public function setClimateSettings(?array $climate_settings): static
  1970.     {
  1971.         $this->climate_settings $climate_settings;
  1972.         return $this;
  1973.     }
  1974.     public function getUnits(): ?array
  1975.     {
  1976.         return $this->units;
  1977.     }
  1978.     public function setUnits(?array $units): static
  1979.     {
  1980.         $this->units $units;
  1981.         return $this;
  1982.     }
  1983.     /**
  1984.      * @return Collection<int, PostReport>
  1985.      */
  1986.     public function getPostReports(): Collection
  1987.     {
  1988.         return $this->postReports;
  1989.     }
  1990.     public function addPostReport(PostReport $postReport): static
  1991.     {
  1992.         if (!$this->postReports->contains($postReport)) {
  1993.             $this->postReports->add($postReport);
  1994.             $postReport->setReportedByUserId($this);
  1995.         }
  1996.         return $this;
  1997.     }
  1998.     public function removePostReport(PostReport $postReport): static
  1999.     {
  2000.         if ($this->postReports->removeElement($postReport)) {
  2001.             // set the owning side to null (unless already changed)
  2002.             if ($postReport->getReportedByUserId() === $this) {
  2003.                 $postReport->setReportedByUserId(null);
  2004.             }
  2005.         }
  2006.         return $this;
  2007.     }
  2008. }