<?php
namespace App\Entity;
use App\Repository\CategorieRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=CategorieRepository::class)
*/
class Categorie
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $nom;
/**
* @ORM\Column(type="text")
*/
private $texte;
/**
* @ORM\Column(type="string", length=255)
*/
private $photo;
/**
* @ORM\OneToMany(targetEntity=Produit::class, mappedBy="categorie")
*/
private $produits;
/**
* @ORM\Column(type="string", length=255)
*/
private $photobg;
public function __construct()
{
$this->cat = new ArrayCollection();
$this->produits = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getNom(): ?string
{
return $this->nom;
}
public function setNom(string $nom): self
{
$this->nom = $nom;
return $this;
}
public function getTexte(): ?string
{
return $this->texte;
}
public function setTexte(string $texte): self
{
$this->texte = $texte;
return $this;
}
public function getPhoto(): ?string
{
return $this->photo;
}
public function setPhoto(string $photo): self
{
$this->photo = $photo;
return $this;
}
/**
* @return Collection<int, Produit>
*/
public function getProduits(): Collection
{
return $this->produits;
}
public function addProduit(Produit $produit): self
{
if (!$this->produits->contains($produit)) {
$this->produits[] = $produit;
$produit->setCategorie($this);
}
return $this;
}
public function removeProduit(Produit $produit): self
{
if ($this->produits->removeElement($produit)) {
// set the owning side to null (unless already changed)
if ($produit->getCategorie() === $this) {
$produit->setCategorie(null);
}
}
return $this;
}
public function getPhotobg(): ?string
{
return $this->photobg;
}
public function setPhotobg(string $photobg): self
{
$this->photobg = $photobg;
return $this;
}
}