<?php
namespace App\Entity;
use App\Repository\FavoriteCategoryRepository;
use Doctrine\ORM\Mapping as ORM;
// /**
// * @ORM\Entity(repositoryClass=FavoriteCategoryRepository::class)
// */
#[ORM\Entity(repositoryClass: FavoriteCategoryRepository::class)]
class FavoriteCategory
{
// /**
// * @ORM\Id
// * @ORM\GeneratedValue(strategy="AUTO")
// * @ORM\Column(type="integer", unique=true )
// */
#[ORM\Id]
#[ORM\GeneratedValue(strategy: "AUTO")]
#[ORM\Column(type: "integer", unique: true)]
private $id;
// /**
// * @ORM\ManyToOne(targetEntity=User::class, inversedBy="favoriteCategories")
// * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
// */
#[ORM\ManyToOne(targetEntity: User::class, inversedBy: "favoriteCategories")]
#[ORM\JoinColumn(nullable: false, onDelete: "CASCADE")]
private $user;
// /**
// * @ORM\ManyToOne(targetEntity=Category::class)
// * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
// */
#[ORM\ManyToOne(targetEntity: Category::class)]
#[ORM\JoinColumn(nullable: false, onDelete: "CASCADE")]
private $category;
public function getId(): ?int
{
return $this->id;
}
public function getUser(): ?int
{
return $this->user->getId();
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
public function getCategory(): ?int
{
return $this->category->getId();
}
public function setCategory(?Category $category): self
{
$this->category = $category;
return $this;
}
}