<?php
namespace App\Entity;
use App\Repository\CategoryRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=CategoryRepository::class)
*/
class Category
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\OneToMany(targetEntity=Properties::class, mappedBy="category", cascade={"remove"})
*/
private $properties;
/**
* @ORM\Column(type="string", length=1255, nullable=true)
*/
private $describ;
public function __construct()
{
$this->properties = 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;
}
/**
* @return Collection<int, Properties>
*/
public function getProperties(): Collection
{
return $this->properties;
}
public function addProperty(Properties $property): self
{
if (!$this->properties->contains($property)) {
$this->properties[] = $property;
$property->setCategory($this);
}
return $this;
}
public function removeProperty(Properties $property): self
{
if ($this->properties->removeElement($property)) {
// set the owning side to null (unless already changed)
if ($property->getCategory() === $this) {
$property->setCategory(null);
}
}
return $this;
}
public function getDescrib(): ?string
{
return $this->describ;
}
public function setDescrib(string $describ): self
{
$this->describ = $describ;
return $this;
}
}