vendor/store.shopware.com/ndsrecipemanager/src/Core/Content/Recipe/RecipeEntity.php line 18

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Nds\RecipeManager\Core\Content\Recipe;
  3. use Nds\RecipeManager\Core\Content\Recipe\RecipeMedia\RecipeMediaCollection;
  4. use Shopware\Core\Content\Media\MediaEntity;
  5. use Nds\RecipeManager\Core\Content\Tag\TagCollection;
  6. use Shopware\Core\Framework\DataAbstractionLayer\Entity;
  7. use Nds\RecipeManager\Core\Content\Related\RelatedCollection;
  8. use Nds\RecipeManager\Core\Content\Category\CategoryCollection;
  9. use Nds\RecipeManager\Core\Content\Difficulty\DifficultyEntity;
  10. use Shopware\Core\Framework\DataAbstractionLayer\EntityIdTrait;
  11. use Nds\RecipeManager\Core\Content\Ingredient\IngredientCollection;
  12. use Nds\RecipeManager\Core\Content\Recipe\RecipeMedia\RecipeMediaEntity;
  13. use Shopware\Core\Framework\DataAbstractionLayer\EntityCustomFieldsTrait;
  14. use Nds\RecipeManager\Core\Content\Recipe\Aggregate\RecipeTranslation\RecipeTranslationCollection;
  15. class RecipeEntity extends Entity
  16. {
  17.     use EntityIdTrait;
  18.     use EntityCustomFieldsTrait;
  19.     /**
  20.      * @var string
  21.      */
  22.     protected $name;
  23.     /**
  24.      * @var string|null
  25.      */
  26.     protected $subhead;
  27.     /**
  28.      * @var string|null
  29.      */
  30.     protected $description;
  31.     /**
  32.      * @var string|null
  33.      */
  34.     protected $preparation;
  35.     /**
  36.      * @var string|null
  37.      */
  38.     protected $metaTitle;
  39.     /**
  40.      * @var string|null
  41.      */
  42.     protected $metaDescription;
  43.     /**
  44.      * @var string
  45.      */
  46.     protected $slug;
  47.     /**
  48.      * @var string|null
  49.      */
  50.     protected $preparationTime;
  51.     /**
  52.      * @var float|null
  53.      */
  54.     protected $energy;
  55.     /**
  56.      * @var float|null
  57.      */
  58.     protected $calories;
  59.     /**
  60.      * @var float|null
  61.      */
  62.     protected $protein;
  63.     /**
  64.      * @var float|null
  65.      */
  66.     protected $carbohydrates;
  67.     /**
  68.      * @var float|null
  69.      */
  70.     protected $fat;
  71.     /**
  72.      * @var string|null
  73.      */
  74.     protected $robots;
  75.     /**
  76.      * @var bool|null
  77.      */
  78.     protected $active;
  79.     /**
  80.      * @var bool
  81.      */
  82.     protected $portionCalculatorActive;
  83.     /**
  84.      * @var int|null
  85.      */
  86.     protected $portionQuantity;
  87.     /**
  88.      * @var CategoryCollection|null
  89.      */
  90.     protected $categories;
  91.     /**
  92.      * @var TagCollection|null
  93.      */
  94.     protected $tags;
  95.     /**
  96.      * @var IngredientCollection|null
  97.      */
  98.     protected $ingredients;
  99.     /**
  100.      * @var RecipeMediaCollection|null
  101.      */
  102.     protected $media;
  103.     /**
  104.      * @var string|null
  105.      */
  106.     protected $coverId;
  107.     /**
  108.      * @var MediaEntity|null
  109.      */
  110.     protected $cover;
  111.     /**
  112.      * @var string
  113.      */
  114.     protected $difficultyId;
  115.     /**
  116.      * @var DifficultyEntity|null
  117.      */
  118.     protected $difficulty;
  119.     /**
  120.      * @var RelatedCollection|null
  121.      */
  122.     protected $relatedRecipes;
  123.     /**
  124.      * @var RecipeTranslationCollection|null
  125.      */
  126.     protected $translations;
  127.     /**
  128.      * @var \DateTimeInterface|null
  129.      */
  130.     protected $createdAt;
  131.     /**
  132.      * @var \DateTimeInterface|null
  133.      */
  134.     protected $updatedAt;
  135.     public function getName(): string
  136.     {
  137.         return $this->name;
  138.     }
  139.     public function setName(string $name): void
  140.     {
  141.         $this->name $name;
  142.     }
  143.     public function getSubhead(): ?string
  144.     {
  145.         return $this->subhead;
  146.     }
  147.     public function setSubhead(?string $subhead): void
  148.     {
  149.         $this->subhead $subhead;
  150.     }
  151.     public function getDescription(): ?string
  152.     {
  153.         return $this->description;
  154.     }
  155.     public function setDescription(?string $description): void
  156.     {
  157.         $this->description $description;
  158.     }
  159.     public function getPreparation(): ?string
  160.     {
  161.         return $this->preparation;
  162.     }
  163.     public function setPreparation(?string $preparation): void
  164.     {
  165.         $this->preparation $preparation;
  166.     }
  167.     public function getMetaTitle(): ?string
  168.     {
  169.         return $this->metaTitle;
  170.     }
  171.     public function setMetaTitle(?string $metaTitle): void
  172.     {
  173.         $this->metaTitle $metaTitle;
  174.     }
  175.     public function getMetaDescription(): ?string
  176.     {
  177.         return $this->metaDescription;
  178.     }
  179.     public function setMetaDescription(?string $metaDescription): void
  180.     {
  181.         $this->metaDescription $metaDescription;
  182.     }
  183.     public function getSlug(): string
  184.     {
  185.         return $this->slug;
  186.     }
  187.     public function setSlug(string $slug): void
  188.     {
  189.         $this->slug $slug;
  190.     }
  191.     public function getPreparationTime(): ?string
  192.     {
  193.         return $this->preparationTime;
  194.     }
  195.     public function setPreparationTime(string $preparationTime): void
  196.     {
  197.         $this->preparationTime $preparationTime;
  198.     }
  199.     public function getEnergy(): ?float
  200.     {
  201.         return $this->energy;
  202.     }
  203.     public function setEnergy(?float $energy): void
  204.     {
  205.         $this->energy $energy;
  206.     }
  207.     public function getCalories(): ?float
  208.     {
  209.         return $this->calories;
  210.     }
  211.     public function setCalories(?float $calories): void
  212.     {
  213.         $this->calories $calories;
  214.     }
  215.     public function getProtein(): ?float
  216.     {
  217.         return $this->protein;
  218.     }
  219.     public function setProtein(?float $protein): void
  220.     {
  221.         $this->protein $protein;
  222.     }
  223.     public function getCarbohydrates(): ?float
  224.     {
  225.         return $this->carbohydrates;
  226.     }
  227.     public function setCarbohydrates(?float $carbohydrates): void
  228.     {
  229.         $this->carbohydrates $carbohydrates;
  230.     }
  231.     public function getFat(): ?float
  232.     {
  233.         return $this->fat;
  234.     }
  235.     public function setFat(?float $fat): void
  236.     {
  237.         $this->fat $fat;
  238.     }
  239.     public function getRobots(): ?string
  240.     {
  241.         return $this->robots;
  242.     }
  243.     public function setRobots(?string $robots): void
  244.     {
  245.         $this->robots $robots;
  246.     }
  247.     public function getActive(): ?bool
  248.     {
  249.         return $this->active;
  250.     }
  251.     public function setActive(?bool $active): void
  252.     {
  253.         $this->active $active;
  254.     }
  255.     public function isPortionCalculatorActive(): bool
  256.     {
  257.         return $this->portionCalculatorActive;
  258.     }
  259.     public function setPortionCalculatorActive(bool $portionCalculatorActive): void
  260.     {
  261.         $this->portionCalculatorActive $portionCalculatorActive;
  262.     }
  263.     public function getPortionQuantity(): ?int
  264.     {
  265.         return $this->portionQuantity;
  266.     }
  267.     public function setPortionQuantity(?int $portionQuantity): void
  268.     {
  269.         $this->portionQuantity $portionQuantity;
  270.     }
  271.     public function getCategories(): ?CategoryCollection
  272.     {
  273.         return $this->categories;
  274.     }
  275.     public function setCategories(CategoryCollection $categories): void
  276.     {
  277.         $this->categories $categories;
  278.     }
  279.     public function getTags(): ?TagCollection
  280.     {
  281.         return $this->tags;
  282.     }
  283.     public function setTags(TagCollection $tags): void
  284.     {
  285.         $this->tags $tags;
  286.     }
  287.     public function getIngredients(): ?IngredientCollection
  288.     {
  289.         return $this->ingredients;
  290.     }
  291.     public function setIngredients(IngredientCollection $ingredients): void
  292.     {
  293.         $this->ingredients $ingredients;
  294.     }
  295.     public function getMedia(): ?RecipeMediaCollection
  296.     {
  297.         return $this->media;
  298.     }
  299.     public function setMedia(?RecipeMediaCollection $media): void
  300.     {
  301.         $this->media $media;
  302.     }
  303.     public function getCoverId(): ?string
  304.     {
  305.         return $this->coverId;
  306.     }
  307.     public function setcoverId(?string $coverId): void
  308.     {
  309.         $this->coverId $coverId;
  310.     }
  311.     public function getCover(): ?MediaEntity
  312.     {
  313.         return $this->cover;
  314.     }
  315.     public function setCover(?MediaEntity $cover): void
  316.     {
  317.         $this->cover $cover;
  318.     }
  319.     public function getDifficultyId(): string
  320.     {
  321.         return $this->difficultyId;
  322.     }
  323.     public function setDifficultyId(string $difficultyId): void
  324.     {
  325.         $this->difficultyId $difficultyId;
  326.     }
  327.     public function getDifficulty(): ?DifficultyEntity
  328.     {
  329.         return $this->difficulty;
  330.     }
  331.     public function setDifficulty(DifficultyEntity $difficulty): void
  332.     {
  333.         $this->difficulty $difficulty;
  334.     }
  335.     public function getRelatedRecipes(): ?RelatedCollection
  336.     {
  337.         return $this->relatedRecipes;
  338.     }
  339.     public function setRelatedRecipes(RelatedCollection $relatedRecipes): void
  340.     {
  341.         $this->relatedRecipes $relatedRecipes;
  342.     }
  343.     public function getTranslations(): ?RecipeTranslationCollection
  344.     {
  345.         return $this->translations;
  346.     }
  347.     public function setTranslations(RecipeTranslationCollection $translations): void
  348.     {
  349.         $this->translations $translations;
  350.     }
  351.     public function getCreatedAt(): \DateTimeInterface
  352.     {
  353.         return $this->createdAt;
  354.     }
  355.     public function setCreatedAt(\DateTimeInterface $createdAt): void
  356.     {
  357.         $this->createdAt $createdAt;
  358.     }
  359.     public function getUpdatedAt(): ?\DateTimeInterface
  360.     {
  361.         return $this->updatedAt;
  362.     }
  363.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): void
  364.     {
  365.         $this->updatedAt $updatedAt;
  366.     }
  367.     public function hasNutritionalValues(): bool
  368.     {
  369.         return $this->energy !== null || $this->calories !== null || $this->protein !== null || $this->fat !== null || $this->carbohydrates !== null;
  370.     }
  371.     public function hasTags(): bool
  372.     {
  373.         return \count($this->tags) > 0;
  374.     }
  375.     public function hasRelatedRecipes(): bool
  376.     {
  377.         return \count($this->relatedRecipes) > 0;
  378.     }
  379. }