src/Entity/User.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\UserRepository;
  4. use Carbon\Carbon;
  5. use DateTime;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Doctrine\ORM\Mapping\HasLifecycleCallbacks;
  10. use Doctrine\ORM\Mapping\PrePersist;
  11. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  12. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  13. use Symfony\Component\Security\Core\User\UserInterface;
  14. use Symfony\Component\Serializer\Annotation\Groups;
  15. use Symfony\Component\Validator\Constraints as Assert;
  16. #[ORM\Entity(repositoryClass: UserRepository::class)]
  17. #[HasLifecycleCallbacks]
  18. #[UniqueEntity('username', message: 'Ce compte existe déjà. Veuillez utiliser une autre adresse email ou vous connecter.')]
  19. class User implements UserInterface, PasswordAuthenticatedUserInterface
  20. {
  21.     #[ORM\Id]
  22.     #[ORM\GeneratedValue]
  23.     #[ORM\Column]
  24.     #[Groups(["list_recipes", "user_info","show_recipe", "show_course", "comment_list", "show_subscription", "show_recipe_count"])]
  25.     private ?int $id = null;
  26.     #[ORM\Column(length: 180, unique: true)]
  27.     #[Assert\NotBlank(message: 'Champ mot de passe est requis')]
  28.     #[Groups(["show_course", "comment_list", "list_recipes", "show_recipe", "user_info", "show_subscription", "show_order", "show_recipe_count"])]
  29.     private ?string $email = null;
  30.     #[ORM\Column]
  31.     private array $roles = [];
  32.     /**
  33.      * @var string The hashed password
  34.      */
  35.     #[Assert\NotBlank(message: 'Champ mot de passe est requis')]
  36.     #[Assert\Length(min: 8, minMessage: 'Le mot de passe doit contenir au moins 8 caratères')]
  37.     #[ORM\Column]
  38.     private ?string $password = null;
  39.     #[Assert\NotBlank(message: 'Le champ Nom est requis')]
  40.     #[ORM\Column(length: 255, nullable: true)]
  41.     #[Groups(["show_course", "comment_list", "list_recipes", "show_recipe", "user_info", "show_subscription", "show_order", "show_restaurant"])]
  42.     private ?string $nom = null;
  43.     #[Assert\NotBlank(message: 'Le champ Prénom(s) est requis')]
  44.     #[ORM\Column(length: 255, nullable: true)]
  45.     #[Groups(["show_course", "comment_list", "list_recipes", "show_recipe", "user_info", "show_subscription", "show_order", "show_restaurant"])]
  46.     private ?string $prenoms = null;
  47.     #[Assert\NotBlank(message: 'Le champ email est requis')]
  48.     #[Groups(["user_info"])]
  49.     #[ORM\Column(length: 255, nullable: true, unique: true)]
  50.     private ?string $username = null;
  51.     #[ORM\Column(length: 255, nullable: true)]
  52.     private ?string $birthday = null;
  53.     #[ORM\Column(length: 255, nullable: true)]
  54.     #[Groups(["show_course", "comment_list", "list_recipes", "show_recipe", "user_info"])]
  55.     private ?string $adresse = null;
  56.     #[ORM\Column(length: 255, nullable: true)]
  57.     #[Groups(["show_course", "comment_list", "list_recipes", "show_recipe", "user_info"])]
  58.     private ?string $ville = null;
  59.     // #[Assert\NotBlank(message: 'Ce champ est requis')]
  60.     #[Groups(["user_info"])]
  61.     #[ORM\Column(length: 255, nullable: true)]
  62.     private ?string $dial_code = null;
  63.     #[Assert\NotBlank(message: 'Le Numéro de télépone est requis')]
  64.     #[Groups(["user_info", "show_order", "show_subscription", "show_course"])]
  65.     #[ORM\Column(length: 255)]
  66.     private ?string $numero = null;
  67.     #[ORM\Column(length: 255, nullable: true)]
  68.     private ?string $code_pays = null;
  69.     #[ORM\Column(length: 255, nullable: true)]
  70.     private ?DateTime  $password_requested_at = null;
  71.     #[ORM\Column(length: 255, nullable: true)]
  72.     private ?string $token = null;
  73.     #[ORM\Column(length: 255, nullable: true)]
  74.     private ?string $pays = null;
  75.     #[ORM\Column(length: 255, nullable: true)]
  76.     private ?string $lien_facebook = null;
  77.     #[ORM\Column(length: 255, nullable: true)]
  78.     private ?string $nom_complet = null;
  79.     #[ORM\Column(length: 255, nullable: true)]
  80.     private ?string $lien_site_web = null;
  81.     #[ORM\Column(length: 255, nullable: true)]
  82.     private ?string $type_compte = null;
  83.     #[ORM\Column(length: 255, nullable: true)]
  84.     private ?bool $actif = null;
  85.     #[ORM\Column(length: 255, nullable: true)]
  86.     private ?bool $email_verified = null;
  87.     #[ORM\Column(nullable: true, options: ["default" => 0])]
  88.     #[Groups(["user_info", "list_recipes"])]
  89.     private ?bool $is_cooker = null;
  90.     #[ORM\Column(nullable: true, options: ["default" => 0])]
  91.     #[Groups(["user_info"])]
  92.     private ?bool $is_admin = null;
  93.     #[ORM\Column(options: ["default" => 0], nullable: true)]
  94.     private ?bool $has_restaurant = null;
  95.     #[Groups(["user_info", "show_restaurant"])]
  96.     private $checkSubscriptionTime;
  97.     #[ORM\OneToMany(mappedBy: 'user', targetEntity: Course::class)]
  98.     #[Groups(["user_info"])]
  99.     private Collection $courses;
  100.     #[ORM\OneToMany(mappedBy: 'owner', targetEntity: Restaurant::class)]
  101.     #[Groups(["user_info"])]
  102.     private Collection $restaurants;
  103.     #[Groups(["user_info", "list_recipes", "show_recipe", "show_course", "list_courses"])]
  104.     #[ORM\Column(length: 255, nullable: true, options: ["default" => "https://i.imgur.com/zCL2LAh.png"])]
  105.     private ?string $photo = null;
  106.    
  107.     #[Groups(["for_abj"])]
  108.     private ?string $photoFullPath = null;
  109.    
  110.     #[Groups(["for_abj"])]
  111.     private ?string $profilFullPath = null;
  112.     #[ORM\OneToMany(mappedBy: 'user', targetEntity: Order::class)]
  113.     #[Groups(["user_info"])]
  114.     private Collection $orders;
  115.     #[ORM\OneToMany(mappedBy: 'owner', targetEntity: Shop::class)]
  116.     private Collection $shops;
  117.     #[ORM\ManyToMany(targetEntity: Subscription::class, mappedBy: 'subscriber')]
  118.     #[Groups(["user_info"])]
  119.     #[ORM\JoinColumn(referencedColumnName: 'subscription_id', nullable: true, onDelete: "CASCADE")]
  120.     private Collection $subscriptions;
  121.     #[Groups(['user_info'])]
  122.     private $currentSubscription = [];
  123.     #[ORM\OneToMany(mappedBy: 'user', targetEntity: CookingTricks::class)]
  124.     #[Groups(["user_info"])]
  125.     private Collection $cookingTricks;
  126.     #[ORM\OneToMany(mappedBy: 'user', targetEntity: Recipe::class)]
  127.     #[Groups(["user_info"])]
  128.     private Collection $recipes;
  129.     #[ORM\OneToMany(mappedBy: 'liker', targetEntity: Like::class)]
  130.     #[Groups(["user_info"])]
  131.     private Collection $likes;
  132.     #[ORM\ManyToMany(targetEntity: BookMaker::class, mappedBy: 'saver')]
  133.     #[Groups(["user_info"])]
  134.     private Collection $bookMakers;
  135.     #[ORM\ManyToMany(targetEntity: Rate::class, mappedBy: 'user')]
  136.     private Collection $rates;
  137.     #[ORM\ManyToMany(targetEntity: RateRestaurant::class, mappedBy: 'user')]
  138.     private Collection $rateRestaurants;
  139.     #[ORM\OneToMany(mappedBy: 'publisher', targetEntity: Course::class)]
  140.     #[Groups(["user_info"])]
  141.     private Collection $cookingCourses;
  142.     #[ORM\OneToMany(mappedBy: 'user', targetEntity: Transactions::class)]
  143.     private Collection $transactions;
  144.     #[ORM\ManyToMany(targetEntity: RecipeCount::class, mappedBy: 'visitor')]
  145.     private Collection $recipeCounts;
  146.     #[ORM\Column(type: "datetime", nullable: true)]
  147.     #[Groups(["list_recipes", "user_info", "show_recipe", "show_order", "comment_list"])]
  148.     private \DateTimeInterface $date_creation;
  149.     #[ORM\Column(type: "datetime", nullable: true)]
  150.     #[Groups(["list_recipes", "user_info", "show_recipe", "show_order", "comment_list"])]
  151.     private ?\DateTimeInterface $date_modification;
  152.     #[ORM\Column(type: "datetime", nullable: true)]
  153.     #[Groups(["list_recipes", "user_info", "show_recipe", "show_order", "comment_list"])]
  154.     private ?\DateTimeInterface $date_suppression;
  155.     #[ORM\OneToMany(mappedBy: 'user', targetEntity: UserSessions::class)]
  156.     private Collection $userSessions;
  157.     #[ORM\ManyToMany(targetEntity: CourseParticipants::class, mappedBy: 'participants')]
  158.     private Collection $courseParticipants;
  159.     // use Timestapable;
  160.     // use base64Field;
  161.     public function __construct()
  162.     {
  163.         $this->courses = new ArrayCollection();
  164.         $this->restaurants = new ArrayCollection();
  165.         $this->orders = new ArrayCollection();
  166.         $this->shops = new ArrayCollection();
  167.         $this->subscriptions = new ArrayCollection();
  168.         $this->cookingTricks = new ArrayCollection();
  169.         $this->recipes = new ArrayCollection();
  170.         $this->likes = new ArrayCollection();
  171.         $this->bookMakers = new ArrayCollection();
  172.         // $this->rates = new ArrayCollection();
  173.         // $this->rateRestaurants = new ArrayCollection();
  174.         $this->cookingCourses = new ArrayCollection();
  175.         $this->transactions = new ArrayCollection();
  176.         $this->recipeCounts = new ArrayCollection();
  177.         $this->userSessions = new ArrayCollection();
  178.         $this->courseParticipants = new ArrayCollection();
  179.     }
  180.     public function getId(): ?int
  181.     {
  182.         return $this->id;
  183.     }
  184.     public function getEmail(): ?string
  185.     {
  186.         return $this->email;
  187.     }
  188.     public function setEmail(string $email): self
  189.     {
  190.         $this->email = $email;
  191.         return $this;
  192.     }
  193.     /**
  194.      * A visual identifier that represents this user.
  195.      *
  196.      * @see UserInterface   
  197.      */
  198.     public function getUserIdentifier(): string
  199.     {
  200.         // return (string) $this->username;
  201.         return (string) $this->email;
  202.     }
  203.     /**
  204.      * @see UserInterface
  205.      */
  206.     public function getRoles(): array
  207.     {
  208.         $roles = $this->roles;
  209.         // guarantee every user at least has ROLE_USER
  210.         $roles[] = 'ROLE_USER';
  211.         return array_unique($roles);
  212.     }
  213.     public function setRoles(array $roles): self
  214.     {
  215.         $this->roles = $roles;
  216.         return $this;
  217.     }
  218.     /**
  219.      * @see PasswordAuthenticatedUserInterface
  220.      */
  221.     public function getPassword(): string
  222.     {
  223.         return $this->password;
  224.     }
  225.     public function setPassword(string $password): self
  226.     {
  227.         $this->password = $password;
  228.         return $this;
  229.     }
  230.     /**
  231.      * @see UserInterface
  232.      */
  233.     public function eraseCredentials()
  234.     {
  235.         // If you store any temporary, sensitive data on the user, clear it here
  236.         // $this->plainPassword = $this->password;
  237.     }
  238.     // public function getSpeudo(): ?string
  239.     // {
  240.     //     return $this->speudo;
  241.     // }
  242.     // public function setSpeudo(string $speudo): self
  243.     // {
  244.     //     $this->speudo = $speudo;
  245.     //     return $this;
  246.     // }
  247.     public function getBirthday(): ?string
  248.     {
  249.         return $this->birthday;
  250.     }
  251.     public function setBirthday(?string $birthday): self
  252.     {
  253.         $this->birthday = $birthday;
  254.         return $this;
  255.     }
  256.     public function getDialCode(): ?string
  257.     {
  258.         return $this->dial_code;
  259.     }
  260.     public function setDialCode(?string $dial_code): self
  261.     {
  262.         $this->dial_code = $dial_code;
  263.         return $this;
  264.     }
  265.     public function isIsCooker(): ?bool
  266.     {
  267.         return $this->is_cooker;
  268.     }
  269.     public function setIsCooker(?bool $is_cooker): self
  270.     {
  271.         $this->is_cooker = $is_cooker;
  272.         return $this;
  273.     }
  274.     public function isHasRestaurant(): ?bool
  275.     {
  276.         return $this->has_restaurant;
  277.     }
  278.     public function setHasRestaurant(?bool $has_restaurant): self
  279.     {
  280.         $this->has_restaurant = $has_restaurant;
  281.         return $this;
  282.     }
  283.     /**
  284.      * @return Collection<int, Course>
  285.      */
  286.     public function getCourses(): Collection
  287.     {
  288.         return $this->courses;
  289.     }
  290.     public function addCourse(Course $course): self
  291.     {
  292.         if (!$this->courses->contains($course)) {
  293.             $this->courses->add($course);
  294.             $course->setUser($this);
  295.         }
  296.         return $this;
  297.     }
  298.     public function removeCourse(Course $course): self
  299.     {
  300.         if ($this->courses->removeElement($course)) {
  301.             // set the owning side to null (unless already changed)
  302.             if ($course->getUser() === $this) {
  303.                 $course->setUser(null);
  304.             }
  305.         }
  306.         return $this;
  307.     }
  308.     /**
  309.      * @return Collection<int, Restaurant>
  310.      */
  311.     public function getRestaurants(): Collection
  312.     {
  313.         return $this->restaurants;
  314.     }
  315.     public function addRestaurant(Restaurant $restaurant): self
  316.     {
  317.         if (!$this->restaurants->contains($restaurant)) {
  318.             $this->restaurants->add($restaurant);
  319.             $restaurant->setOwner($this);
  320.         }
  321.         return $this;
  322.     }
  323.     public function removeRestaurant(Restaurant $restaurant): self
  324.     {
  325.         if ($this->restaurants->removeElement($restaurant)) {
  326.             // set the owning side to null (unless already changed)
  327.             if ($restaurant->getOwner() === $this) {
  328.                 $restaurant->setOwner(null);
  329.             }
  330.         }
  331.         return $this;
  332.     }
  333.     /**
  334.      * @return Collection<int, Order>
  335.      */
  336.     public function getOrders(): Collection
  337.     {
  338.         return $this->orders;
  339.     }
  340.     public function addOrder(Order $order): self
  341.     {
  342.         if (!$this->orders->contains($order)) {
  343.             $this->orders->add($order);
  344.             $order->setUser($this);
  345.         }
  346.         return $this;
  347.     }
  348.     public function removeOrder(Order $order): self
  349.     {
  350.         if ($this->orders->removeElement($order)) {
  351.             // set the owning side to null (unless already changed)
  352.             if ($order->getUser() === $this) {
  353.                 $order->setUser(null);
  354.             }
  355.         }
  356.         return $this;
  357.     }
  358.     /**
  359.      * @return Collection<int, Shop>
  360.      */
  361.     public function getShops(): Collection
  362.     {
  363.         return $this->shops;
  364.     }
  365.     public function addShop(Shop $shop): self
  366.     {
  367.         if (!$this->shops->contains($shop)) {
  368.             $this->shops->add($shop);
  369.             $shop->setOwner($this);
  370.         }
  371.         return $this;
  372.     }
  373.     public function removeShop(Shop $shop): self
  374.     {
  375.         if ($this->shops->removeElement($shop)) {
  376.             // set the owning side to null (unless already changed)
  377.             if ($shop->getOwner() === $this) {
  378.                 $shop->setOwner(null);
  379.             }
  380.         }
  381.         return $this;
  382.     }
  383.     /**
  384.      * @return Collection<int, Subscription>
  385.      */
  386.     public function getSubscriptions(): Collection
  387.     {
  388.         $sub = $this->subscriptions->filter(
  389.             function ($subscription) {
  390.                 if ($subscription?->getSubscriptionType()?->getTitle() != "cooker") {
  391.                     return true;
  392.                 }
  393.             }
  394.         );
  395.         return $sub;
  396.     }
  397.     public function addSubscription(Subscription $subscription): self
  398.     {
  399.         if (!$this->subscriptions->contains($subscription)) {
  400.             $this->subscriptions->add($subscription);
  401.             $subscription->addSubscriber($this);
  402.         }
  403.         return $this;
  404.     }
  405.     public function removeSubscription(Subscription $subscription): self
  406.     {
  407.         if ($this->subscriptions->removeElement($subscription)) {
  408.             $subscription->removeSubscriber($this);
  409.         }
  410.         return $this;
  411.     }
  412.     /**
  413.      * @return Collection<int, CookingTricks>
  414.      */
  415.     public function getCookingTricks(): Collection
  416.     {
  417.         return $this->cookingTricks;
  418.     }
  419.     public function addCookingTrick(CookingTricks $cookingTrick): self
  420.     {
  421.         if (!$this->cookingTricks->contains($cookingTrick)) {
  422.             $this->cookingTricks->add($cookingTrick);
  423.             $cookingTrick->setUser($this);
  424.         }
  425.         return $this;
  426.     }
  427.     public function removeCookingTrick(CookingTricks $cookingTrick): self
  428.     {
  429.         if ($this->cookingTricks->removeElement($cookingTrick)) {
  430.             // set the owning side to null (unless already changed)
  431.             if ($cookingTrick->getUser() === $this) {
  432.                 $cookingTrick->setUser(null);
  433.             }
  434.         }
  435.         return $this;
  436.     }
  437.     /**
  438.      * Get the value of username
  439.      */
  440.     public function getUsername()
  441.     {
  442.         return $this->username;
  443.     }
  444.     /**
  445.      * Set the value of username
  446.      *
  447.      * @return  self
  448.      */
  449.     public function setUsername($username)
  450.     {
  451.         $this->username = $username;
  452.         return $this;
  453.     }
  454.     /**
  455.      * @return Collection<int, Recipe>
  456.      */
  457.     public function getRecipes()
  458.     {
  459.         return $this->recipes;
  460.     }
  461.     public function addRecipe(Recipe $recipe): self
  462.     {
  463.         if (!$this->recipes->contains($recipe)) {
  464.             $this->recipes->add($recipe);
  465.             $recipe->setUser($this);
  466.         }
  467.         return $this;
  468.     }
  469.     public function removeRecipe(Recipe $recipe): self
  470.     {
  471.         if ($this->recipes->removeElement($recipe)) {
  472.             // set the owning side to null (unless already changed)
  473.             if ($recipe->getUser() === $this) {
  474.                 $recipe->setUser(null);
  475.             }
  476.         }
  477.         return $this;
  478.     }
  479.     /**
  480.      * @return Collection<int, Like>
  481.      */
  482.     public function getLikes($need = false)
  483.     {
  484.         if ($need == true) {
  485.             return $this->likes;
  486.         }
  487.         return null;
  488.     }
  489.     public function addLike(Like $like): self
  490.     {
  491.         if (!$this->likes->contains($like)) {
  492.             $this->likes->add($like);
  493.             $like->setLiker($this);
  494.         }
  495.         return $this;
  496.     }
  497.     public function removeLike(Like $like): self
  498.     {
  499.         if ($this->likes->removeElement($like)) {
  500.             // set the owning side to null (unless already changed)
  501.             if ($like->getLiker() === $this) {
  502.                 $like->setLiker(null);
  503.             }
  504.         }
  505.         return $this;
  506.     }
  507.     /**
  508.      * @return Collection<int, BookMaker>
  509.      */
  510.     public function getBookMakers()
  511.     {
  512.         return $this->bookMakers;
  513.     }
  514.     public function addBookMaker(BookMaker $bookMaker): self
  515.     {
  516.         if (!$this->bookMakers->contains($bookMaker)) {
  517.             $this->bookMakers->add($bookMaker);
  518.             $bookMaker->addSaver($this);
  519.         }
  520.         return $this;
  521.     }
  522.     public function removeBookMaker(BookMaker $bookMaker): self
  523.     {
  524.         if ($this->bookMakers->removeElement($bookMaker)) {
  525.             $bookMaker->removeSaver($this);
  526.         }
  527.         return $this;
  528.     }
  529.     /**
  530.      * @return Collection<int, Course>
  531.      */
  532.     public function getCookingCourses(): Collection
  533.     {
  534.         return $this->cookingCourses;
  535.     }
  536.     public function addCookingCourse(Course $cookingCourse): self
  537.     {
  538.         if (!$this->cookingCourses->contains($cookingCourse)) {
  539.             $this->cookingCourses->add($cookingCourse);
  540.             $cookingCourse->setPublisher($this);
  541.         }
  542.         return $this;
  543.     }
  544.     public function removeCookingCourse(Course $cookingCourse): self
  545.     {
  546.         if ($this->cookingCourses->removeElement($cookingCourse)) {
  547.             // set the owning side to null (unless already changed)
  548.             if ($cookingCourse->getPublisher() === $this) {
  549.                 $cookingCourse->setPublisher(null);
  550.             }
  551.         }
  552.         return $this;
  553.     }
  554.     public function getCurrentSubscription()
  555.     {
  556.         $this->currentSubscription = $this->getSubscriptions();
  557.         if (empty($this->currentSubscription)) {
  558.             return [];
  559.         } else {
  560.             $subscriptionPaid = $this->getSubscriptions()->filter(
  561.                 function ($value) {
  562.                     $endDate = $value->getEndDate();
  563.                     if (!(Carbon::parse($endDate)->isPast())) {
  564.                         if ($value->getCommande() != null) {
  565.                             if ($value->getCommande()->isIsPaid() == true) {
  566.                                 return true;
  567.                             }
  568.                         }
  569.                     }
  570.                 }
  571.             );
  572.             return $subscriptionPaid->last();
  573.         }
  574.     }
  575.     public function getCheckSubscriptionTime()
  576.     {
  577.         $current = $this->getCurrentSubscription();
  578.         if(!empty($current)){
  579.             if ($current->getCommande()?->isIsPaid() ==  true) {
  580.                 return true;
  581.             }
  582.         }
  583.         if (!empty($this->getSubscriptions()?->last())) {
  584.             if ($this->getSubscriptions()?->last()->getCommande()?->isIsPaid() ==  true) {
  585.                 $startDate = Carbon::parse($this->getSubscriptions()?->last()?->getStartDate());
  586.                 $endDate = Carbon::parse($this->getSubscriptions()?->last()?->getEndDate());
  587.                 $check = Carbon::now()->between($startDate, $endDate);
  588.             } else {
  589.                 $check = false;
  590.             }
  591.             if ($check) {
  592.                 return true;
  593.             } else {
  594.                 return false;
  595.             }
  596.         }
  597.         return false;
  598.     }
  599.     /* 
  600.     public function getActifSubscriptions()
  601.     {
  602.     $subscriptionList = $this->getSubscriptions();
  603.     $subscriptionList->filter( function ($sub) {
  604.         if($sub->getCommande()->){
  605.         }
  606.     });
  607. } 
  608.     */
  609.     /**
  610.      * @return Collection<int, Transactions>
  611.      */
  612.     public function getTransactions(): Collection
  613.     {
  614.         return $this->transactions;
  615.     }
  616.     public function addTransaction(Transactions $transaction): self
  617.     {
  618.         if (!$this->transactions->contains($transaction)) {
  619.             $this->transactions->add($transaction);
  620.             $transaction->setUser($this);
  621.         }
  622.         return $this;
  623.     }
  624.     public function removeTransaction(Transactions $transaction): self
  625.     {
  626.         if ($this->transactions->removeElement($transaction)) {
  627.             // set the owning side to null (unless already changed)
  628.             if ($transaction->getUser() === $this) {
  629.                 $transaction->setUser(null);
  630.             }
  631.         }
  632.         return $this;
  633.     }
  634.     /**
  635.      * @return Collection<int, RecipeCount>
  636.      */
  637.     public function getRecipeCounts(): Collection
  638.     {
  639.         return $this->recipeCounts;
  640.     }
  641.     public function addRecipeCount(RecipeCount $recipeCount): self
  642.     {
  643.         if (!$this->recipeCounts->contains($recipeCount)) {
  644.             $this->recipeCounts->add($recipeCount);
  645.             $recipeCount->addVisitor($this);
  646.         }
  647.         return $this;
  648.     }
  649.     public function removeRecipeCount(RecipeCount $recipeCount): self
  650.     {
  651.         if ($this->recipeCounts->removeElement($recipeCount)) {
  652.             $recipeCount->removeVisitor($this);
  653.         }
  654.         return $this;
  655.     }
  656.     public function getNom()
  657.     {
  658.         return $this->nom;
  659.     }
  660.     public function setNom($nom)
  661.     {
  662.         $this->nom = $nom;
  663.         return $this;
  664.     }
  665.     public function getPrenoms()
  666.     {
  667.         return $this->prenoms;
  668.     }
  669.     public function setPrenoms($prenoms)
  670.     {
  671.         $this->prenoms = $prenoms;
  672.         return $this;
  673.     }
  674.     public function getAdresse()
  675.     {
  676.         return $this->adresse;
  677.     }
  678.     public function setAdresse($adresse)
  679.     {
  680.         $this->adresse = $adresse;
  681.         return $this;
  682.     }
  683.     public function getVille()
  684.     {
  685.         return $this->ville;
  686.     }
  687.     public function setVille($ville)
  688.     {
  689.         $this->ville = $ville;
  690.         return $this;
  691.     }
  692.     public function getNumero()
  693.     {
  694.         return $this->numero;
  695.     }
  696.     public function setNumero($numero)
  697.     {
  698.         $this->numero = $numero;
  699.         return $this;
  700.     }
  701.     public function getCodePays()
  702.     {
  703.         return $this->code_pays;
  704.     }
  705.     public function setCodePays($code_pays)
  706.     {
  707.         $this->code_pays = $code_pays;
  708.         return $this;
  709.     }
  710.     public function getPays()
  711.     {
  712.         return $this->pays;
  713.     }
  714.     public function setPays($pays)
  715.     {
  716.         $this->pays = $pays;
  717.         return $this;
  718.     }
  719.     public function getDateCreation()
  720.     {
  721.         return $this->date_creation;
  722.     }
  723.     public function setDateCreation($date_creation)
  724.     {
  725.         $this->date_creation = $date_creation;
  726.         return $this;
  727.     }
  728.     #[PrePersist]
  729.     public function saveDateCreation()
  730.     {
  731.         $this->setDateCreation(new \DateTimeImmutable());
  732.         $this->setDateModification(new \DateTimeImmutable());
  733.     }
  734.     public function getDateModification()
  735.     {
  736.         return $this->date_modification;
  737.     }
  738.     public function setDateModification($date_modification)
  739.     {
  740.         $this->date_modification = $date_modification;
  741.         return $this;
  742.     }
  743.     public function getDateSuppression()
  744.     {
  745.         return $this->date_suppression;
  746.     }
  747.     /**
  748.      * Get the value of is_admin
  749.      */
  750.     public function getIsAdmin()
  751.     {
  752.         return $this->is_admin;
  753.     }
  754.     /**
  755.      * @return Collection<int, UserSessions>
  756.      */
  757.     public function getUserSessions(): Collection
  758.     {
  759.         return $this->userSessions;
  760.     }
  761.     public function addUserSession(UserSessions $userSession): self
  762.     {
  763.         if (!$this->userSessions->contains($userSession)) {
  764.             $this->userSessions->add($userSession);
  765.             $userSession->setUser($this);
  766.         }
  767.         return $this;
  768.     }
  769.     public function removeUserSession(UserSessions $userSession): self
  770.     {
  771.         if ($this->userSessions->removeElement($userSession)) {
  772.             // set the owning side to null (unless already changed)
  773.             if ($userSession->getUser() === $this) {
  774.                 $userSession->setUser(null);
  775.             }
  776.         }
  777.         return $this;
  778.     }
  779.     public function getType_compte()
  780.     {
  781.         return $this->type_compte;
  782.     }
  783.     public function setType_compte($type_compte)
  784.     {
  785.         $this->type_compte = $type_compte;
  786.         return $this;
  787.     }
  788.     public function getNomComplet()
  789.     {
  790.         return $this->nom_complet;
  791.     }
  792.     public function setNomComplet($nom_complet)
  793.     {
  794.         $this->nom_complet = $nom_complet;
  795.         return $this;
  796.     }
  797.     public function setIsAdmin($is_admin)
  798.     {
  799.         $this->is_admin = $is_admin;
  800.         return $this;
  801.     }
  802.     public function getTypeCompte()
  803.     {
  804.         return $this->type_compte;
  805.     }
  806.     public function setTypeCompte($type_compte)
  807.     {
  808.         $this->type_compte = $type_compte;
  809.         return $this;
  810.     }
  811.     public function setToken($token)
  812.     {
  813.         $this->token = $token;
  814.         return $this;
  815.     }
  816.     public function getToken()
  817.     {
  818.         return $this->token;
  819.     }
  820.     public function setPasswordRequestedAt($date)
  821.     {
  822.         $this->password_requested_at = $date;
  823.     }
  824.     public function getPasswordRequestedAt()
  825.     {
  826.         return $this->password_requested_at;
  827.     }
  828.     /**
  829.      * @return Collection<int, CourseParticipants>
  830.      */
  831.     public function getCourseParticipants(): Collection
  832.     {
  833.         return $this->courseParticipants;
  834.     }
  835.     public function addCourseParticipant(CourseParticipants $courseParticipant): self
  836.     {
  837.         if (!$this->courseParticipants->contains($courseParticipant)) {
  838.             $this->courseParticipants->add($courseParticipant);
  839.             $courseParticipant->addParticipant($this);
  840.         }
  841.         return $this;
  842.     }
  843.     public function removeCourseParticipant(CourseParticipants $courseParticipant): self
  844.     {
  845.         if ($this->courseParticipants->removeElement($courseParticipant)) {
  846.             $courseParticipant->removeParticipant($this);
  847.         }
  848.         return $this;
  849.     }
  850.     public function setEmailVerified($email_verified)
  851.     {
  852.         $this->email_verified = $email_verified;
  853.         return $this;
  854.     }
  855.     public function getPhoto()
  856.     {
  857.         return $this->photo;
  858.     }
  859.     public function getPhotoFullPath()
  860.     {
  861.         if(str_contains($this->photoFullPath, "images/")){
  862.             $baseUrl = "https://cuisine.abidjan.net";
  863.             return "$baseUrl/".$this->photoFullPath;
  864.         }
  865.         return "https://i.imgur.com/zCL2LAh.png";
  866.     }
  867.     public function setPhoto($photo)
  868.     {
  869.         $this->photo = $photo;
  870.         return $this;
  871.     }
  872.     public function getActif()
  873.     {
  874.         return $this->actif;
  875.     }
  876.     public function setActif($actif)
  877.     {
  878.         $this->actif = $actif;
  879.         return $this;
  880.     }
  881.     public function getEmailVerified()
  882.     {
  883.         return $this->email_verified;
  884.     }
  885.     public function getProfilFullPath()
  886.     {
  887.         $baseUrl = "https://cuisine.abidjan.net";
  888.         $profilPath = "$baseUrl/"."profil-utilisateur/".$this->id;
  889.         $this->profilFullPath= $profilPath;
  890.         return $this->profilFullPath;
  891.     }
  892. }