Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ############################
- # MenuAudience
- ############################
- namespace App\Entity;
- use ApiPlatform\Core\Annotation\ApiResource;
- use ApiPlatform\Core\Annotation\ApiFilter;
- use App\Repository\MenuAudienceRepository;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\Common\Collections\Collection;
- use Doctrine\ORM\Mapping as ORM;
- /**
- * @ApiResource(
- * collectionOperations={"get", "post"},
- * itemOperations={"get", "put", "delete"},
- * )
- * @ORM\Entity(repositoryClass=MenuAudienceRepository::class)
- */
- class MenuAudience
- {
- /**
- * @ORM\Id()
- * @ORM\GeneratedValue()
- * @ORM\Column(type="integer")
- */
- private $id;
- /**
- * @ORM\Column(type="string", length=100)
- */
- private $name;
- /**
- * @ORM\Column(type="string", length=255)
- */
- private $description;
- /**
- * @ORM\Column(type="boolean")
- */
- private $published;
- /**
- * @ORM\Column(type="integer")
- */
- private $orderNumber;
- /**
- * @ORM\OneToMany(targetEntity=MealAudienceCategory::class, mappedBy="menuAudience", orphanRemoval=true)
- */
- private $mealAudienceCategories;
- public function __construct()
- {
- $this->mealAudienceCategories = new ArrayCollection();
- }
- public function getId(): ?int
- {
- return $this->id;
- }
- public function getName(): ?string
- {
- return $this->name;
- }
- public function setName(string $name): self
- {
- $this->name = $name;
- return $this;
- }
- public function getDescription(): ?string
- {
- return $this->description;
- }
- public function setDescription(string $description): self
- {
- $this->description = $description;
- return $this;
- }
- public function getPublished(): ?bool
- {
- return $this->published;
- }
- public function setPublished(bool $published): self
- {
- $this->published = $published;
- return $this;
- }
- public function getOrderNumber(): ?int
- {
- return $this->orderNumber;
- }
- public function setOrderNumber(int $orderNumber): self
- {
- $this->orderNumber = $orderNumber;
- return $this;
- }
- /**
- * @return Collection|MealAudienceCategory[]
- */
- public function getMealAudienceCategories(): Collection
- {
- return $this->mealAudienceCategories;
- }
- public function addMealAudienceCategory(MealAudienceCategory $mealAudienceCategory): self
- {
- if (!$this->mealAudienceCategories->contains($mealAudienceCategory)) {
- $this->mealAudienceCategories[] = $mealAudienceCategory;
- $mealAudienceCategory->setMenuAudience($this);
- }
- return $this;
- }
- public function removeMealAudienceCategory(MealAudienceCategory $mealAudienceCategory): self
- {
- if ($this->mealAudienceCategories->contains($mealAudienceCategory)) {
- $this->mealAudienceCategories->removeElement($mealAudienceCategory);
- // set the owning side to null (unless already changed)
- if ($mealAudienceCategory->getMenuAudience() === $this) {
- $mealAudienceCategory->setMenuAudience(null);
- }
- }
- return $this;
- }
- }
- ############################
- # MealAudienceCategory
- ############################
- <?php
- namespace App\Entity;
- use ApiPlatform\Core\Annotation\ApiResource;
- use ApiPlatform\Core\Annotation\ApiFilter;
- use App\Repository\MealAudienceCategoryRepository;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\Common\Collections\Collection;
- use Doctrine\ORM\Mapping as ORM;
- /**
- * @ApiResource(
- * collectionOperations={"get", "post"},
- * itemOperations={"get", "put", "delete"},
- * )
- * @ORM\Entity(repositoryClass=MealAudienceCategoryRepository::class)
- */
- class MealAudienceCategory
- {
- /**
- * @ORM\Id()
- * @ORM\GeneratedValue()
- * @ORM\Column(type="integer")
- */
- private $id;
- /**
- * @ORM\Column(type="string", length=50)
- */
- private $name;
- /**
- * @ORM\Column(type="string", length=255)
- */
- private $description;
- /**
- * @ORM\Column(type="integer")
- */
- private $orderNumber;
- /**
- * @ORM\Column(type="boolean")
- */
- private $published;
- /**
- * @ORM\ManyToOne(targetEntity=menuAudience::class, inversedBy="mealAudienceCategories")
- * @ORM\JoinColumn(nullable=false)
- */
- private $menuAudience;
- public function getId(): ?int
- {
- return $this->id;
- }
- public function getName(): ?string
- {
- return $this->name;
- }
- public function setName(string $name): self
- {
- $this->name = $name;
- return $this;
- }
- public function getDescription(): ?string
- {
- return $this->description;
- }
- public function setDescription(string $description): self
- {
- $this->description = $description;
- return $this;
- }
- public function getOrderNumber(): ?int
- {
- return $this->orderNumber;
- }
- public function setOrderNumber(int $orderNumber): self
- {
- $this->orderNumber = $orderNumber;
- return $this;
- }
- public function getPublished(): ?bool
- {
- return $this->published;
- }
- public function setPublished(bool $published): self
- {
- $this->published = $published;
- return $this;
- }
- public function getMenuAudience(): ?menuAudience
- {
- return $this->menuAudience;
- }
- public function setMenuAudience(?menuAudience $menuAudience): self
- {
- $this->menuAudience = $menuAudience;
- return $this;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement