src/Entity/FavoriteCategory.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\FavoriteCategoryRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. // /**
  6. //  * @ORM\Entity(repositoryClass=FavoriteCategoryRepository::class)
  7. //  */
  8. #[ORM\Entity(repositoryClassFavoriteCategoryRepository::class)]
  9. class FavoriteCategory
  10. {
  11.     // /**
  12.     //  * @ORM\Id
  13.     //  * @ORM\GeneratedValue(strategy="AUTO")
  14.     //  * @ORM\Column(type="integer", unique=true )
  15.     //  */
  16.     #[ORM\Id]
  17.     #[ORM\GeneratedValue(strategy"AUTO")]
  18.     #[ORM\Column(type"integer"uniquetrue)]
  19.     private $id;
  20.     // /**
  21.     //  * @ORM\ManyToOne(targetEntity=User::class, inversedBy="favoriteCategories")
  22.     //  * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  23.     //  */
  24.     #[ORM\ManyToOne(targetEntityUser::class, inversedBy"favoriteCategories")]
  25.     #[ORM\JoinColumn(nullablefalseonDelete"CASCADE")]
  26.     private $user;
  27.     // /**
  28.     //  * @ORM\ManyToOne(targetEntity=Category::class)
  29.     //  * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  30.     //  */
  31.     #[ORM\ManyToOne(targetEntityCategory::class)]
  32.     #[ORM\JoinColumn(nullablefalseonDelete"CASCADE")]
  33.     private $category;
  34.     public function getId(): ?int
  35.     {
  36.         return $this->id;
  37.     }
  38.     public function getUser(): ?int
  39.     {
  40.         return $this->user->getId();
  41.     }
  42.     public function setUser(?User $user): self
  43.     {
  44.         $this->user $user;
  45.         return $this;
  46.     }
  47.     public function getCategory(): ?int
  48.     {
  49.         return $this->category->getId();
  50.     }
  51.     public function setCategory(?Category $category): self
  52.     {
  53.         $this->category $category;
  54.         return $this;
  55.     }
  56. }