src/Flexy/ShopBundle/Entity/Brand.php line 14
<?phpnamespace App\Flexy\ShopBundle\Entity;use ApiPlatform\Core\Annotation\ApiResource;use App\Flexy\ShopBundle\Entity\Product\Product;use App\Flexy\ShopBundle\Repository\BrandRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ApiResource]#[ORM\Entity(repositoryClass: BrandRepository::class)]class Brand implements \Stringable{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column(type: 'integer')]private $id;#[ORM\Column(type: 'string', length: 255)]private ?string $name = null;#[ORM\OneToMany(targetEntity: Product::class, mappedBy: 'brand')]private \Doctrine\Common\Collections\Collection|array $products;public function __construct(){$this->products = new ArrayCollection();}public function __toString(): string{return (string)$this->name;}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;}/*** @return Collection|Product[]*/public function getProducts(): Collection{return $this->products;}public function addProduct(Product $product): self{if (!$this->products->contains($product)) {$this->products[] = $product;$product->setBrand($this);}return $this;}public function removeProduct(Product $product): self{if ($this->products->removeElement($product)) {// set the owning side to null (unless already changed)if ($product->getBrand() === $this) {$product->setBrand(null);}}return $this;}}