<?phpnamespace App\Entity\Tutoring;use App\Repository\Tutoring\BranchRepository;use App\Traits\Actions;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use ApiPlatform\Core\Annotation\ApiResource;/** * Branch */#[ORM\Entity(repositoryClass: BranchRepository::class)]#[ORM\Table(name: 'hs_tc_tutoring_branch')]#[ApiResource]class Branch implements \Stringable{ use Actions; /** * @var string */ #[ORM\Column(name: 'name', type: 'string', length: 255)] private $name; #[ORM\OneToMany(mappedBy: 'branch', targetEntity: Level::class, cascade: ['persist'], orphanRemoval: true)] private ?Collection $levels = null; public function __construct() { $this->createAt=new \DateTime('now'); $this->published=true; }// /**// * Get id// *// * @return integer// */// public function getId()// {// return $this->id;// }// /** * Set nom * * @param string $name * @return Branch */ public function setName($name) { $this->name = $name; return $this; } /** * Get name * * @return string */ public function getName() { return $this->name; } function __toString(): string { return $this->name; } /** * Add level * * * @return Branch */ public function addLevel(Level $level) { $level->setBranch($this); $this->levels[] = $level; return $this; } /** * Remove level */ public function removeLevel(Level $level) { $this->levels->removeElement($level); } /** * Get levels * * @return ArrayCollection */ public function getLevels() { return $this->levels; }}