src/Flexy/FrontBundle/Entity/Slider.php line 13
<?php
namespace App\Flexy\FrontBundle\Entity;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Flexy\FrontBundle\Repository\SliderRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ApiResource]
#[ORM\Entity(repositoryClass: SliderRepository::class)]
class Slider
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\OneToMany(targetEntity: Slide::class, mappedBy: 'slider', orphanRemoval: true, cascade: ['persist'])]
private \Doctrine\Common\Collections\Collection|array $slides;
#[ORM\Column(type: 'boolean', nullable: true)]
private ?bool $isEnabled = null;
public function __construct()
{
$this->slides = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getIsEnabled(): ?bool
{
return $this->isEnabled;
}
public function setIsEnabled(?bool $isEnabled): self
{
$this->isEnabled = $isEnabled;
return $this;
}
/**
* @return Collection<int, Slide>
*/
public function getSlides(): Collection
{
return $this->slides;
}
public function addSlide(Slide $slide): self
{
if (!$this->slides->contains($slide)) {
$this->slides[] = $slide;
$slide->setSlider($this);
}
return $this;
}
public function removeSlide(Slide $slide): self
{
if ($this->slides->removeElement($slide)) {
// set the owning side to null (unless already changed)
if ($slide->getSlider() === $this) {
$slide->setSlider(null);
}
}
return $this;
}
}