for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use ApiPlatform\Core\Annotation\ApiResource;
/**
* @ORM\Entity(repositoryClass="App\Repository\CategoryRepository")
* @UniqueEntity(
* fields={"name"},
* message="Cette catégorie est déjà enregistrée !"
* )
* @ApiResource
*/
class Category
{
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
private $id;
* @ORM\Column(type="string", length=255)
* @Assert\NotBlank
private $name;
public function __construct()
$this->adverts = new ArrayCollection();
adverts
}
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;