src/Entity/Recipe.php line 25

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use DateTimeImmutable;
  4. use Cocur\Slugify\Slugify;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use App\Entity\traits\base64Field;
  8. use App\Entity\traits\Timestapable;
  9. use App\Repository\RecipeRepository;
  10. use Carbon\Carbon;
  11. use Doctrine\ORM\Mapping\PrePersist;
  12. use Doctrine\Common\Collections\Collection;
  13. use Doctrine\ORM\Mapping\HasLifecycleCallbacks;
  14. use Doctrine\Common\Collections\ArrayCollection;
  15. use Doctrine\ORM\Mapping\PostLoad;
  16. use Symfony\Component\DependencyInjection\ContainerInterface;
  17. use Symfony\Component\Validator\Constraints as Assert;
  18. use Symfony\Component\Serializer\Annotation\Groups;
  19. use \Liip\ImagineBundle\Imagine\Cache\CacheManager;
  20. #[ORM\Entity(repositoryClassRecipeRepository::class)]
  21. #[HasLifecycleCallbacks]
  22. class Recipe
  23. {
  24.     use Timestapable;
  25.     use base64Field;
  26.     #[ORM\Id]
  27.     #[ORM\GeneratedValue]
  28.     #[ORM\Column]
  29.     #[Groups(["list_recipes""user_info""show_recipe""for_abj"])]
  30.     private ?int $id null;
  31.     #[Groups(["list_recipes""user_info""show_recipe""for_abj"])]
  32.     private ?string $imageMiniature null;
  33.     #[ORM\Column]
  34.     private ?int $userOldId null;
  35.     #[Groups(["for_abj"])]
  36.     private ?string $pays null;
  37.     #[Groups(["list_recipes""show_recipe""user_info""for_abj"])]
  38.     private $rateAverage;
  39.     #[Groups(["list_recipes""show_recipe""user_info"])]
  40.     private $raterCount;
  41.     #[Groups(["list_recipes"])]
  42.     #[ORM\Column(options: ["comment" => "Reference to RecetteID"], nullabletrue)]
  43.     private ?int $recetteId null;
  44.     #[Groups(["list_recipes"])]
  45.     #[ORM\Column(options: ["comment" => "Reference to hits"], nullabletrue)]
  46.     private ?int $hits null;
  47.     #[ORM\Column(length255nullabletrueoptions: ["comment" => "Reference to image_url"])]
  48.     #[Groups(["list_recipes""show_recipe""user_info""for_abj"])]
  49.     #[Assert\NotBlank(message'Ce champ est requis')]
  50.     private ?string $imageUrl null;
  51.     #[ORM\Column(length255)]
  52.     #[Assert\NotBlank(message'Ce champ est requis')]
  53.     #[Groups(["list_recipes""user_info""show_recipe""for_abj"])]
  54.     private ?string $name;
  55.     #[Groups(["for_abj"])]
  56.     private ?string $total_time_min;
  57.     #[Groups(["for_abj""list_recipes""show_recipe"])]
  58.     private ?string $imageUrlFullPath;
  59.     #[Groups(["for_abj""list_recipes""show_recipe"])]
  60.     private ?string $detailsUrl null;
  61.     #[ORM\Column(length255)]
  62.     #[Groups(["list_recipes""user_info""show_recipes"'show_recipe'"for_abj"])]
  63.     private ?string $slug null;
  64.     #[ORM\Column(length255nullabletrueoptions: ["comment" => "Reference to Nom on old database"])]
  65.     #[Groups(["list_recipes"])]
  66.     private ?string $user_name null;
  67.     #[ORM\Column(length255nullabletrueoptions: ["comment" => "Reference to Email"])]
  68.     #[Groups(["list_recipes"])]
  69.     private ?string $user_email null;
  70.     #[ORM\Column(length255nullabletrueoptions: ["comment" => "Reference to SiteWeb"])]
  71.     #[Groups(["list_recipes"])]
  72.     private ?string $web_site null;
  73.     #[ORM\Column(length255nullabletrueoptions: ["comment" => "Reference to pays"])]
  74.     #[Groups(["list_recipes""user_info"])]
  75.     private ?string $country null;
  76.     #[ORM\Column(nullabletrue)]
  77.     // #[Groups(["list_recipes"])]
  78.     private ?int $recipe_type null;
  79.     #[ORM\Column(nullabletrueoptions: ["comment" => "Number of persons for the recipe"])]
  80.     #[Groups(["list_recipes""show_recipe""user_info"])]
  81.     private ?string $number_of_persons null;
  82.     #[ORM\Column(nullabletrueoptions: ["comment" => "Total cooking time"])]
  83.     #[Groups(["list_recipes""show_recipe""user_info""for_abj"])]
  84.     // #[Assert\NotBlank(message: 'Ce champ est requis')]
  85.     private ?string $total_time null;
  86.     #[ORM\Column(nullabletrueoptions: ["comment" => "Total time for cuisson"])]
  87.     #[Assert\NotBlank(message'Ce champ est requis')]
  88.     #[Groups(["list_recipes""user_info""show_recipe"])]
  89.     private ?string $cooking null;
  90.     #[ORM\Column(nullabletrueoptions: ["comment" => "Total time for marinade"])]
  91.     #[Assert\NotBlank(message'Ce champ est requis')]
  92.     #[Groups(["list_recipes""user_info""show_recipe"])]
  93.     private ?string $marinade null;
  94.     #[ORM\Column(nullabletrueoptions: ["comment" => "Reference to Difficulte"])]
  95.     #[Groups(["list_recipes""user_info"])]
  96.     private ?string $level_name null;
  97.     #[ORM\Column(nullabletrueoptions: ["comment" => "Reference to Cout"])]
  98.     #[Groups(["list_recipes""user_info"])]
  99.     private ?string $pricing null;
  100.     #[ORM\Column(nullabletrueoptions: ["comment" => "Reference to Dedicace"])]
  101.     #[Groups(["list_recipes""show_recipe""show_recipe"])]
  102.     private ?string $dedicace null;
  103.     #[ORM\Column(nullabletrueoptions: ["comment" => "Reference to     Pref"])]
  104.     #[Groups(["list_recipes""user_info""show_recipe"])]
  105.     private ?string $pref null;
  106.     #[ORM\Column(nullabletrueoptions: ["comment" => "Reference to     Pref"])]
  107.     #[Groups(["list_recipes""user_info""show_recipe"])]
  108.     private ?string $published_at null;
  109.     #[ORM\Column(nullabletrueoptions: ["comment" => "Reference to dateUpdate"])]
  110.     #[Groups(["list_recipes"])]
  111.     private ?string $last_updated null;
  112.     #[ORM\Column(nullabletrueoptions: ["comment" => "Reference to IP"])]
  113.     #[Groups(["list_recipes"])]
  114.     private ?string $ip null;
  115.     #[ORM\Column(nullabletrueoptions: ["comment" => "Reference to PE"])]
  116.     #[Groups(["list_recipes""show_recipe"])]
  117.     private ?string $pe null;
  118.     #[ORM\Column(nullabletrueoptions: ["comment" => "Reference to Regime"])]
  119.     #[Groups(["list_recipes""show_recipe"])]
  120.     private ?string $regime null;
  121.     #[ORM\Column(options: ["default" => true])]
  122.     #[Groups(["list_recipes""show_recipe"])]
  123.     private ?bool $is_active;
  124.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  125.     #[Assert\NotBlank(message'Ce champ est requis')]
  126.     #[Groups(["list_recipes""show_recipe""user_info""for_abj"])]
  127.     private ?string $description null;
  128.     #[ORM\Column(length255nullabletrue)]
  129.     #[Groups(["list_recipes""show_recipe""user_info"])]
  130.     private ?string $country_code null;
  131.     #[ORM\ManyToOne(inversedBy'recipes'cascade: ['persist'])]
  132.     #[Assert\NotBlank(message'Veuillez choisir une categorie s\'il vous plait')]
  133.     #[Groups(["list_recipes""show_recipe""user_info""for_abj"])]
  134.     #[ORM\JoinColumn(name"recipe_type_id"referencedColumnName"id"nullabletrue)]
  135.     private ?RecipeType $recipeType null;
  136.     #[ORM\ManyToOne(inversedBy'recipes'cascade: ['persist'])]
  137.     #[Assert\NotBlank(message'Choisissez le niveau s\'il vous plait')]
  138.     #[Groups(["list_recipes""show_recipe"])]
  139.     #[ORM\JoinColumn(name"level_id"referencedColumnName"id"nullabletrue)]
  140.     private ?Level $level null;
  141.     #[ORM\OneToMany(mappedBy'recipe'targetEntityRecipeImages::class)]
  142.     #[Groups(["list_recipes""show_recipe"])]
  143.     private Collection $recipeImages;
  144.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  145.     #[Groups(["list_recipes""show_recipe"])]
  146.     private ?string $suggestions null;
  147.     #[ORM\Column(options: ["default" => false], nullabletrue)]
  148.     private ?bool $is_tutorial null;
  149.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  150.     #[Groups(["show_recipe"])]
  151.     private ?string $video_url null;
  152.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  153.     #[Groups(["list_recipes""show_recipe"])]
  154.     private ?string $ingredient_text null;
  155.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  156.     #[Groups(["list_recipes""show_recipe"])]
  157.     private ?string $ustensilText null;
  158.     #[ORM\OneToMany(mappedBy'recipe'targetEntityCommentRecipe::class)]
  159.     #[Groups(["show_recipe"])]
  160.     private Collection $commentRecipes;
  161.     #[ORM\ManyToOne(inversedBy'recipes')]
  162.     #[Groups(["list_recipes""show_recipe""for_abj"])]
  163.     #[Assert\NotBlank(message'Ce champ est requis')]
  164.     private ?Budget $budget null;
  165.     #[ORM\Column(nullabletrueoptions: ["default" => false])]
  166.     #[Groups(["list_recipes""show_recipe"])]
  167.     private ?bool $has_multiple_step null;
  168.     #[ORM\Column(nullabletrueoptions: ["default" => false])]
  169.     #[Groups(["list_recipes""show_recipe"])]
  170.     private ?bool $isSpotlight null;
  171.     #[ORM\OneToMany(mappedBy'recipe'targetEntityRecipeStep::class)]
  172.     #[Groups(["list_recipes""show_recipe"])]
  173.     private Collection $recipeSteps;
  174.     #[ORM\ManyToMany(targetEntityUtensil::class, mappedBy'recipe')]
  175.     private Collection $utensils;
  176.     #[ORM\Column(typeTypes::TEXTnullabletrueoptions: ["comment" => "Reference to preparation"])]
  177.     #[Groups(["list_recipes""show_recipe"])]
  178.     private ?string $preparationInstructions null;
  179.     #[ORM\ManyToOne(inversedBy'recipes')]
  180.     #[Groups(["list_recipes""show_recipe""for_abj"])]
  181.     private ?User $user null;
  182.     #[ORM\ManyToMany(targetEntityIngredient::class, inversedBy'recipes')]
  183.     #[Groups(["list_recipes""show_recipe"])]
  184.     #[Assert\NotBlank(message'Ajouter au moins 2 ingredients')]
  185.     private Collection $ingredients;
  186.     #[ORM\OneToMany(mappedBy'recipe'targetEntityLike::class)]
  187.     #[Groups(["list_recipes""show_recipe"])]
  188.     private Collection $likes;
  189.     #[ORM\ManyToMany(targetEntityBookMaker::class, mappedBy'recipe')]
  190.     #[Groups(["list_recipes""show_recipe"])]
  191.     private Collection $bookMakers;
  192.     #[ORM\ManyToMany(targetEntityRate::class, mappedBy'recipe')]
  193.     #[Groups(["list_recipes"])]
  194.     private Collection $rates;
  195.     #[ORM\ManyToMany(targetEntityRecipeCount::class, mappedBy'recipe')]
  196.     #[Groups(["list_recipes""show_recipe""user_info"])]
  197.     private Collection $recipeCounts;
  198.     #[Groups(["list_recipes""show_recipe""user_info""for_abj"])]
  199.     private $numberOfViews;
  200.     #[Groups(["list_recipes""show_recipe"])]
  201.     private $checkAbjIsSpotLight;
  202.     #[ORM\Column(length255nullabletrue)]
  203.     private ?string $SpotLightEnd null;
  204.     #[ORM\Column(length255)]
  205.     private ?string $SpotLightStart null;
  206.     #[ORM\Column]
  207.     #[Groups(["list_recipes""show_recipe"])]
  208.     private ?bool $isSpotLightAbj null;
  209.     #[Groups(["list_recipes""show_recipe""for_abj"])]
  210.     #[ORM\Column(length255nullabletrue)]
  211.     private ?string $endAbjDate null;
  212.     #[Groups(["list_recipes""show_recipe""for_abj"])]
  213.     #[ORM\Column(length255)]
  214.     private ?string $startAbjDate null;
  215.     #[ORM\Column(length255)]
  216.     private ?string $origin_country null;
  217.     #[ORM\Column(length255)]
  218.     private ?string $originPlateform null;
  219.     #[Groups(["list_recipes""show_recipe"])]
  220.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  221.     private ?string $preparationInstructionsText null;
  222.     #[ORM\Column(length255)]
  223.     #[Groups(["list_recipes""show_recipe""for_abj"])]
  224.     private ?string $source null;
  225.     // #[ORM\OneToMany(mappedBy: 'recipe', targetEntity: BookMaker::class)]
  226.     // private Collection $savedNb;
  227.     #[PrePersist]
  228.     public function prePersist()
  229.     {
  230.         $this->slug = (new Slugify())->slugify($this->name);
  231.         $this->createdAt = new \DateTimeImmutable();
  232.     }
  233.     //Update before apply any updates
  234.     #[ORM\PreUpdate]
  235.     public function updatedAt()
  236.     {
  237.         $this->setUpdatedAt(new DateTimeImmutable());
  238.     }
  239.     public function __construct(
  240.         // private ContainerInterface $container,public CacheManager $cacheManager
  241.     )
  242.     {
  243.         $this->recipeImages = new ArrayCollection();
  244.         $this->commentRecipes = new ArrayCollection();
  245.         $this->recipeSteps = new ArrayCollection();
  246.         $this->utensils = new ArrayCollection();
  247.         $this->ingredients = new ArrayCollection();
  248.         $this->likes = new ArrayCollection();
  249.         // $this->savedNb = new ArrayCollection();
  250.         $this->bookMakers = new ArrayCollection();
  251.         $this->rates = new ArrayCollection();
  252.         $this->recipeCounts = new ArrayCollection();
  253.     }
  254.     public function getId(): ?int
  255.     {
  256.         return $this->id;
  257.     }
  258.     public function getName(): ?string
  259.     {
  260.         return $this->name;
  261.     }
  262.     public function setName(string $name): self
  263.     {
  264.         $this->name $name;
  265.         return $this;
  266.     }
  267.     public function getDescription(): ?string
  268.     {
  269.         return $this->description;
  270.     }
  271.     public function setDescription(string $description): self
  272.     {
  273.         $this->description $description;
  274.         return $this;
  275.     }
  276.     public function getCountryCode(): ?string
  277.     {
  278.         return $this->country_code;
  279.     }
  280.     public function getPays()
  281.     {
  282.         $country strtolower($this->getCountryCode());
  283.         if (!empty($country) && strlen($country) >= 1) {
  284.             //package rinvex/countries 
  285.             $pays country($country)?->getNativeName();
  286.             if (!empty($pays)) {
  287.                 $this->pays $pays;
  288.                 return $this->pays;
  289.             }
  290.         }
  291.         return "Côte d'Ivoire";
  292.     }
  293.     public function setCountryCode(string $country_code): self
  294.     {
  295.         $this->country_code $country_code;
  296.         return $this;
  297.     }
  298.     public function getRecipeType(): ?RecipeType
  299.     {
  300.         return $this->recipeType;
  301.     }
  302.     public function setRecipeType(?RecipeType $recipeType): self
  303.     {
  304.         $this->recipeType $recipeType;
  305.         return $this;
  306.     }
  307.     public function getLevel(): ?Level
  308.     {
  309.         return $this->level;
  310.     }
  311.     public function setLevel(?Level $level): self
  312.     {
  313.         $this->level $level;
  314.         return $this;
  315.     }
  316.     /**
  317.      * @return Collection<int, RecipeImages>
  318.      */
  319.     public function getRecipeImages(): Collection
  320.     {
  321.         return $this->recipeImages;
  322.     }
  323.     public function addRecipeImage(RecipeImages $recipeImage): self
  324.     {
  325.         if (!$this->recipeImages->contains($recipeImage)) {
  326.             $this->recipeImages->add($recipeImage);
  327.             $recipeImage->setRecipe($this);
  328.         }
  329.         return $this;
  330.     }
  331.     public function removeRecipeImage(RecipeImages $recipeImage): self
  332.     {
  333.         if ($this->recipeImages->removeElement($recipeImage)) {
  334.             // set the owning side to null (unless already changed)
  335.             if ($recipeImage->getRecipe() === $this) {
  336.                 $recipeImage->setRecipe(null);
  337.             }
  338.         }
  339.         return $this;
  340.     }
  341.     public function getSuggestions(): ?string
  342.     {
  343.         return $this->suggestions;
  344.     }
  345.     public function setSuggestions(string $suggestions): self
  346.     {
  347.         $this->suggestions $suggestions;
  348.         return $this;
  349.     }
  350.     public function isIsTutorial(): ?bool
  351.     {
  352.         return $this->is_tutorial;
  353.     }
  354.     public function setIsTutorial(?bool $is_tutorial): self
  355.     {
  356.         $this->is_tutorial $is_tutorial;
  357.         return $this;
  358.     }
  359.     public function getVideoUrl(): ?string
  360.     {
  361.         return $this->video_url;
  362.     }
  363.     public function setVideoUrl(?string $video_url): self
  364.     {
  365.         $this->video_url $video_url;
  366.         return $this;
  367.     }
  368.     /**
  369.      * @return Collection<int, CommentRecipe>
  370.      */
  371.     public function getCommentRecipes(): Collection
  372.     {
  373.         return $this->commentRecipes;
  374.     }
  375.     public function addCommentRecipe(CommentRecipe $commentRecipe): self
  376.     {
  377.         if (!$this->commentRecipes->contains($commentRecipe)) {
  378.             $this->commentRecipes->add($commentRecipe);
  379.             $commentRecipe->setRecipe($this);
  380.         }
  381.         return $this;
  382.     }
  383.     public function removeCommentRecipe(CommentRecipe $commentRecipe): self
  384.     {
  385.         if ($this->commentRecipes->removeElement($commentRecipe)) {
  386.             // set the owning side to null (unless already changed)
  387.             if ($commentRecipe->getRecipe() === $this) {
  388.                 $commentRecipe->setRecipe(null);
  389.             }
  390.         }
  391.         return $this;
  392.     }
  393.     public function getBudget(): ?Budget
  394.     {
  395.         return $this->budget;
  396.     }
  397.     public function setBudget(?Budget $budget): self
  398.     {
  399.         $this->budget $budget;
  400.         return $this;
  401.     }
  402.     public function isHasMultipleStep(): ?bool
  403.     {
  404.         return $this->has_multiple_step;
  405.     }
  406.     public function setHasMultipleStep(?bool $has_multiple_step): self
  407.     {
  408.         $this->has_multiple_step $has_multiple_step;
  409.         return $this;
  410.     }
  411.     /**
  412.      * @return Collection<int, RecipeStep>
  413.      */
  414.     public function getRecipeSteps(): Collection
  415.     {
  416.         return $this->recipeSteps;
  417.     }
  418.     public function addRecipeStep(RecipeStep $recipeStep): self
  419.     {
  420.         if (!$this->recipeSteps->contains($recipeStep)) {
  421.             $this->recipeSteps->add($recipeStep);
  422.             $recipeStep->setRecipe($this);
  423.         }
  424.         return $this;
  425.     }
  426.     public function removeRecipeStep(RecipeStep $recipeStep): self
  427.     {
  428.         if ($this->recipeSteps->removeElement($recipeStep)) {
  429.             // set the owning side to null (unless already changed)
  430.             if ($recipeStep->getRecipe() === $this) {
  431.                 $recipeStep->setRecipe(null);
  432.             }
  433.         }
  434.         return $this;
  435.     }
  436.     /**
  437.      * @return Collection<int, Utensil>
  438.      */
  439.     public function getUtensils(): Collection
  440.     {
  441.         return $this->utensils;
  442.     }
  443.     public function addUtensil(Utensil $utensil): self
  444.     {
  445.         if (!$this->utensils->contains($utensil)) {
  446.             $this->utensils->add($utensil);
  447.             $utensil->addRecipe($this);
  448.         }
  449.         return $this;
  450.     }
  451.     public function removeUtensil(Utensil $utensil): self
  452.     {
  453.         if ($this->utensils->removeElement($utensil)) {
  454.             $utensil->removeRecipe($this);
  455.         }
  456.         return $this;
  457.     }
  458.     /**
  459.      * Get the value of user_name
  460.      */
  461.     public function getUserName()
  462.     {
  463.         return $this->user_name;
  464.     }
  465.     /**
  466.      * Set the value of user_name
  467.      *
  468.      * @return  self
  469.      */
  470.     public function setUserName($user_name)
  471.     {
  472.         $this->user_name $user_name;
  473.         return $this;
  474.     }
  475.     /**
  476.      * Get the value of user_email
  477.      */
  478.     public function getUserEmail()
  479.     {
  480.         return $this->user_email;
  481.     }
  482.     /**
  483.      * Set the value of user_email
  484.      *
  485.      * @return  self
  486.      */
  487.     public function setUserEmail($user_email)
  488.     {
  489.         $this->user_email $user_email;
  490.         return $this;
  491.     }
  492.     /**
  493.      * Get the value of imageUrl
  494.      */
  495.     public function getImageUrl()
  496.     {
  497.         return $this->imageUrl;
  498.     }
  499.     /**
  500.      * Set the value of imageUrl
  501.      *
  502.      * @return  self
  503.      */
  504.     public function setImageUrl($imageUrl)
  505.     {
  506.         $this->imageUrl $imageUrl;
  507.         return $this;
  508.     }
  509.     /**
  510.      * Get the value of web_site
  511.      */
  512.     public function getWebSite()
  513.     {
  514.         return $this->web_site;
  515.     }
  516.     /**
  517.      * Set the value of web_site
  518.      *
  519.      * @return  self
  520.      */
  521.     public function setWebSite($web_site)
  522.     {
  523.         $this->web_site $web_site;
  524.         return $this;
  525.     }
  526.     /**
  527.      * Get the value of country
  528.      */
  529.     public function getCountry()
  530.     {
  531.         return $this->country;
  532.     }
  533.     /**
  534.      * Set the value of country
  535.      *
  536.      * @return  self
  537.      */
  538.     public function setCountry($country)
  539.     {
  540.         $this->country $country;
  541.         return $this;
  542.     }
  543.     /**
  544.      * Set the value of recipe_type
  545.      *
  546.      * @return  self
  547.      */
  548.     /*   public function setRecipe_type($recipe_type)
  549.     {
  550.         $this->recipe_type = $recipe_type;
  551.         return $this;
  552.     } */
  553.     /**
  554.      * Get the value of number_of_persons
  555.      */
  556.     public function getNumberOfPersons()
  557.     {
  558.         return $this->number_of_persons;
  559.     }
  560.     /**
  561.      * Set the value of number_of_persons
  562.      *
  563.      * @return  self
  564.      */
  565.     public function setNumberOfPersons($number_of_persons)
  566.     {
  567.         $this->number_of_persons $number_of_persons;
  568.         return $this;
  569.     }
  570.     /**
  571.      * Get the value of total_time
  572.      */
  573.     public function getTotalTime()
  574.     {
  575.         return $this->total_time;
  576.     }
  577.     /**
  578.      * Get the value of total_time
  579.      */
  580.     public function getTotalTimeMin()
  581.     {
  582.         $this->total_time_min $this->total_time_min " min";
  583.         return $this->total_time_min;
  584.     }
  585.     /**
  586.      * Set the value of total_time
  587.      *
  588.      * @return  self
  589.      */
  590.     public function setTotalTime($total_time)
  591.     {
  592.         $this->total_time $total_time;
  593.         return $this;
  594.     }
  595.     public function setIsActive($is_active)
  596.     {
  597.         $this->is_active $is_active;
  598.         return $this;
  599.     }
  600.     /**
  601.      * Get the value of level_name
  602.      */
  603.     public function getLevelName()
  604.     {
  605.         return $this->level_name;
  606.     }
  607.     /**
  608.      * Set the value of level_name
  609.      *
  610.      * @return  self
  611.      */
  612.     public function setLevelName($level_name)
  613.     {
  614.         $this->level_name $level_name;
  615.         return $this;
  616.     }
  617.     /**
  618.      * Get the value of pricing
  619.      */
  620.     public function getPricing()
  621.     {
  622.         return $this->pricing;
  623.     }
  624.     /**
  625.      * Set the value of pricing
  626.      *
  627.      * @return  self
  628.      */
  629.     public function setPricing($pricing)
  630.     {
  631.         $this->pricing $pricing;
  632.         return $this;
  633.     }
  634.     /**
  635.      * Get the value of dedicace
  636.      */
  637.     public function getDedicace()
  638.     {
  639.         return $this->dedicace;
  640.     }
  641.     /**
  642.      * Set the value of dedicace
  643.      *
  644.      * @return  self
  645.      */
  646.     public function setDedicace($dedicace)
  647.     {
  648.         $this->dedicace $dedicace;
  649.         return $this;
  650.     }
  651.     /**
  652.      * Get the value of pref
  653.      */
  654.     public function getPref()
  655.     {
  656.         return $this->pref;
  657.     }
  658.     /**
  659.      * Set the value of pref
  660.      *
  661.      * @return  self
  662.      */
  663.     public function setPref($pref)
  664.     {
  665.         $this->pref $pref;
  666.         return $this;
  667.     }
  668.     /**
  669.      * Get the value of ip
  670.      */
  671.     public function getIp()
  672.     {
  673.         return $this->ip;
  674.     }
  675.     /**
  676.      * Set the value of ip
  677.      *
  678.      * @return  self
  679.      */
  680.     public function setIp($ip)
  681.     {
  682.         $this->ip $ip;
  683.         return $this;
  684.     }
  685.     /**
  686.      * Get the value of pe
  687.      */
  688.     public function getPe()
  689.     {
  690.         return $this->pe;
  691.     }
  692.     /**
  693.      * Set the value of pe
  694.      *
  695.      * @return  self
  696.      */
  697.     public function setPe($pe)
  698.     {
  699.         $this->pe $pe;
  700.         return $this;
  701.     }
  702.     /**
  703.      * Get the value of regime
  704.      */
  705.     public function getRegime()
  706.     {
  707.         return $this->regime;
  708.     }
  709.     /**
  710.      * Set the value of regime
  711.      *
  712.      * @return  self
  713.      */
  714.     public function setRegime($regime)
  715.     {
  716.         $this->regime $regime;
  717.         return $this;
  718.     }
  719.     /**
  720.      * Get the value of marinade
  721.      */
  722.     public function getMarinade()
  723.     {
  724.         return $this->marinade;
  725.     }
  726.     /**
  727.      * Set the value of marinade
  728.      *
  729.      * @return  self
  730.      */
  731.     public function setMarinade($marinade)
  732.     {
  733.         $this->marinade $marinade;
  734.         return $this;
  735.     }
  736.     public function getCooking()
  737.     {
  738.         return $this->cooking;
  739.     }
  740.     /**
  741.      * Set the value of cooking
  742.      *
  743.      * @return  self
  744.      */
  745.     public function setCooking($cooking)
  746.     {
  747.         $this->cooking $cooking;
  748.         return $this;
  749.     }
  750.     public function getPreparationInstructions()
  751.     {
  752.         return $this->preparationInstructions;
  753.     }
  754.     /**
  755.      * Set the value of preparationInstructions
  756.      *
  757.      * @return  self
  758.      */
  759.     public function setPreparationInstructions($preparationInstructions)
  760.     {
  761.         $this->preparationInstructions $preparationInstructions;
  762.         return $this;
  763.     }
  764.     public function getIngredientText()
  765.     {
  766.         return $this->ingredient_text;
  767.     }
  768.     /**
  769.      * Set the value of preparationInstructions
  770.      *
  771.      * @return  self
  772.      */
  773.     public function setIngredientText($ingredient_text)
  774.     {
  775.         $this->ingredient_text $ingredient_text;
  776.         return $this;
  777.     }
  778.     public function getUstensilText()
  779.     {
  780.         return $this->ustensilText;
  781.     }
  782.     /**
  783.      * Set the value of ustensilText
  784.      *
  785.      * @return  self
  786.      */
  787.     public function setUstensilText($ustensilText)
  788.     {
  789.         $this->ustensilText $ustensilText;
  790.         return $this;
  791.     }
  792.     public function getUser()
  793.     {
  794.         return $this->user;
  795.     }
  796.     public function setUser(?User $user): self
  797.     {
  798.         $this->user $user;
  799.         return $this;
  800.     }
  801.     /**
  802.      * @return Collection<int, Ingredient>
  803.      */
  804.     public function getIngredients(): Collection
  805.     {
  806.         return $this->ingredients;
  807.     }
  808.     public function addIngredient(Ingredient $ingredient): self
  809.     {
  810.         if (!$this->ingredients->contains($ingredient)) {
  811.             $this->ingredients->add($ingredient);
  812.         }
  813.         return $this;
  814.     }
  815.     public function removeIngredient(Ingredient $ingredient): self
  816.     {
  817.         $this->ingredients->removeElement($ingredient);
  818.         return $this;
  819.     }
  820.     /**
  821.      * @return Collection<int, Like>
  822.      */
  823.     public function getLikes(): Collection
  824.     {
  825.         return $this->likes;
  826.     }
  827.     public function addLike(Like $like): self
  828.     {
  829.         if (!$this->likes->contains($like)) {
  830.             $this->likes->add($like);
  831.             $like->setRecipe($this);
  832.         }
  833.         return $this;
  834.     }
  835.     public function removeLike(Like $like): self
  836.     {
  837.         if ($this->likes->removeElement($like)) {
  838.             // set the owning side to null (unless already changed)
  839.             if ($like->getRecipe() === $this) {
  840.                 $like->setRecipe(null);
  841.             }
  842.         }
  843.         return $this;
  844.     }
  845.     /**
  846.      * @return Collection<int, BookMaker>
  847.      */
  848.     public function getBookMakers()
  849.     {
  850.         return $this->bookMakers;
  851.     }
  852.     public function addBookMaker(BookMaker $bookMaker): self
  853.     {
  854.         if (!$this->bookMakers->contains($bookMaker)) {
  855.             $this->bookMakers->add($bookMaker);
  856.             $bookMaker->addRecipe($this);
  857.         }
  858.         return $this;
  859.     }
  860.     public function removeBookMaker(BookMaker $bookMaker): self
  861.     {
  862.         if ($this->bookMakers->removeElement($bookMaker)) {
  863.             $bookMaker->removeRecipe($this);
  864.         }
  865.         return $this;
  866.     }
  867.     /**
  868.      * @return Collection<int, Rate>
  869.      */
  870.     public function getRates(): Collection
  871.     {
  872.         return $this->rates;
  873.     }
  874.     #[PostLoad]
  875.     public function getRateAverage()
  876.     {
  877.         $rates $this->getRates();
  878.         $rateSum 0;
  879.         $this->raterCount count($rates);
  880.         foreach ($rates as $rate) {
  881.             $rateSum += $rate->getNumberOfStart();
  882.         }
  883.         if (count($rates) != 0) {
  884.             $average round($rateSum $this->raterCount1);
  885.         } else {
  886.             $average 0;
  887.         }
  888.         $this->rateAverage $average;
  889.         return $this->rateAverage;
  890.     }
  891.     public function getRaterCount()
  892.     {
  893.         return $this->raterCount;
  894.     }
  895.     public function addRate(Rate $rate): self
  896.     {
  897.         if (!$this->rates->contains($rate)) {
  898.             $this->rates->add($rate);
  899.             $rate->addRecipe($this);
  900.         }
  901.         return $this;
  902.     }
  903.     public function removeRate(Rate $rate): self
  904.     {
  905.         if ($this->rates->removeElement($rate)) {
  906.             $rate->removeRecipe($this);
  907.         }
  908.         return $this;
  909.     }
  910.     public function getRecetteId()
  911.     {
  912.         return $this->recetteId;
  913.     }
  914.     public function getHits()
  915.     {
  916.         return $this->recetteId;
  917.     }
  918.     public function getSlug()
  919.     {
  920.         return $this->slug;
  921.     }
  922.     public function getPublishedAt()
  923.     {
  924.         return $this->published_at;
  925.     }
  926.     public function getLastUpdated()
  927.     {
  928.         return $this->last_updated;
  929.     }
  930.     public function getIsActive()
  931.     {
  932.         return $this->is_active;
  933.     }
  934.     public function getIsSpotlight()
  935.     {
  936.         return $this->isSpotlight;
  937.     }
  938.     public function setIsSpotlight($state): self
  939.     {
  940.         $this->isSpotlight $state;
  941.         return $this;
  942.     }
  943.     public function setSlug($slug)
  944.     {
  945.         $this->slug $slug;
  946.     }
  947.     /**
  948.      * @return Collection<int, RecipeCount>
  949.      */
  950.     public function getRecipeCounts(): Collection
  951.     {
  952.         return $this->recipeCounts;
  953.     }
  954.     public function getNumberOfViews()
  955.     {
  956.         return $this->recipeCounts->count();
  957.     }
  958.     public function addRecipeCount(RecipeCount $recipeCount): self
  959.     {
  960.         if (!$this->recipeCounts->contains($recipeCount)) {
  961.             $this->recipeCounts->add($recipeCount);
  962.             $recipeCount->addRecipe($this);
  963.         }
  964.         return $this;
  965.     }
  966.     public function removeRecipeCount(RecipeCount $recipeCount): self
  967.     {
  968.         if ($this->recipeCounts->removeElement($recipeCount)) {
  969.             $recipeCount->removeRecipe($this);
  970.         }
  971.         return $this;
  972.     }
  973.     public function getSpotLightEnd(): ?string
  974.     {
  975.         return $this->SpotLightEnd;
  976.     }
  977.     public function setSpotLightEnd(?string $SpotLightEnd): self
  978.     {
  979.         $this->SpotLightEnd $SpotLightEnd;
  980.         return $this;
  981.     }
  982.     public function getSpotLightStart(): ?string
  983.     {
  984.         return $this->SpotLightStart;
  985.     }
  986.     public function setSpotLightStart(string $SpotLightStart): self
  987.     {
  988.         $this->SpotLightStart $SpotLightStart;
  989.         return $this;
  990.     }
  991.     public function isIsSpotLightAbj(): ?bool
  992.     {
  993.         return $this->isSpotLightAbj;
  994.     }
  995.     public function setIsSpotLightAbj(bool $isSpotLightAbj): self
  996.     {
  997.         $this->isSpotLightAbj $isSpotLightAbj;
  998.         return $this;
  999.     }
  1000.     public function getEndAbjDate(): ?string
  1001.     {
  1002.         return $this->endAbjDate;
  1003.     }
  1004.     public function setEndAbjDate(?string $endAbjDate): self
  1005.     {
  1006.         $this->endAbjDate $endAbjDate;
  1007.         return $this;
  1008.     }
  1009.     public function getStartAbjDate(): ?string
  1010.     {
  1011.         return $this->startAbjDate;
  1012.     }
  1013.     public function setStartAbjDate(string $startAbjDate): self
  1014.     {
  1015.         $this->startAbjDate $startAbjDate;
  1016.         return $this;
  1017.     }
  1018.     public function getCheckAbjIsSpotLight()
  1019.     {
  1020.         $startDate Carbon::parse($this->startAbjDate);
  1021.         $endDate Carbon::parse($this->endAbjDate);
  1022.         $check Carbon::now()->between($startDate$endDate);
  1023.         if ($check) {
  1024.             return true;
  1025.         } else {
  1026.             return false;
  1027.         }
  1028.     }
  1029.     public function setUserOldId($userOldId)
  1030.     {
  1031.         $this->userOldId $userOldId;
  1032.         return $this;
  1033.     }
  1034.     public function getOriginCountry(): ?string
  1035.     {
  1036.         return $this->origin_country;
  1037.     }
  1038.     public function setOriginCountry(string $originCountry): self
  1039.     {
  1040.         $this->origin_country $originCountry;
  1041.         return $this;
  1042.     }
  1043.     public function getOriginPlateform(): ?string
  1044.     {
  1045.         return $this->originPlateform;
  1046.     }
  1047.     public function setOriginPlateform(string $originPlateform): self
  1048.     {
  1049.         $this->originPlateform $originPlateform;
  1050.         return $this;
  1051.     }
  1052.     public function getPreparationInstructionsText(): ?string
  1053.     {
  1054.         return $this->preparationInstructionsText;
  1055.     }
  1056.     public function setPreparationInstructionsText(?string $preparationInstructionsText): self
  1057.     {
  1058.         $this->preparationInstructionsText $preparationInstructionsText;
  1059.         return $this;
  1060.     }
  1061.     public function getSource(): ?string
  1062.     {
  1063.         return $this->source;
  1064.     }
  1065.     public function setSource(string $source): self
  1066.     {
  1067.         $this->source $source;
  1068.         return $this;
  1069.     }
  1070.     public function getDetailsUrl()
  1071.     {
  1072.         // $baseUrl = $this->container->getParameter("BASE_URL");
  1073.         $baseUrl "https://cuisine.abidjan.net";
  1074.         return "$baseUrl/" "details-recette/" $this->slug;
  1075.     }
  1076.     public function getImageMiniature()
  1077.     {
  1078.         return $this->imageMiniature ?? "";
  1079.     }
  1080.     public function setImageMiniature($imageMiniaturePath)
  1081.     {
  1082.         $this->imageMiniature $imageMiniaturePath;
  1083.     }
  1084.     public function getImageUrlFullPath()
  1085.     {
  1086.         // $baseUrl = $this->container->getParameter("BASE_URL");
  1087.         $baseUrl "https://api.abidjan.net";
  1088.         // $baseUrl = "https://cuisine.abidjan.net";
  1089.         $this->imageUrlFullPath str_contains($this->imageUrl"images/") ? "$baseUrl/" $this->imageUrl "$baseUrl/images/" $this->imageUrl;
  1090.         // $this->imageUrlFullPath = "$baseUrl/".$this->imageUrl;
  1091.         return $this->imageUrlFullPath;
  1092.     }
  1093. }