<?php
namespace App\Entity\System;
use App\Repository\System\categoriesRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: categoriesRepository::class)]
class categories
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string',length: 255, nullable: true)]
private $title;
#[ORM\Column(type: 'text', nullable:true)]
private $link;
#[ORM\Column(type: 'string',length: 255, nullable: true)]
private $icon;
#[ORM\Column(type: 'datetime', nullable: true)]
private $created_at;
#[ORM\Column(type: 'datetime', nullable: true)]
private $updated_at;
#[ORM\OneToMany(mappedBy: 'categories_id', targetEntity: subCategories::class)]
private $subCategories;
#[ORM\OneToMany(mappedBy: 'categories_id', targetEntity: access::class)]
private $accesses;
public function __construct()
{
$this->subCategories = new ArrayCollection();
$this->accesses = new ArrayCollection();
}
public function setId(?int $id): self
{
$this->id = $id;
return $this;
}
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(?string $title): self
{
$this->title = $title;
return $this;
}
public function getLink(): ?string
{
return $this->link;
}
public function setLink(?string $link): self
{
$this->link = $link;
return $this;
}
public function getIcon(): ?string
{
return $this->icon;
}
public function setIcon(?string $icon): self
{
$this->icon = $icon;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->created_at;
}
public function setCreatedAt(?\DateTimeInterface $created_at): self
{
$this->created_at = $created_at;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updated_at;
}
public function setUpdatedAt(?\DateTimeInterface $updated_at): self
{
$this->updated_at = $updated_at;
return $this;
}
/**
* @return Collection<int, subCategories>
*/
public function getSubCategories(): Collection
{
return $this->subCategories;
}
public function addSubCategory(subCategories $subCategory): self
{
if (!$this->subCategories->contains($subCategory)) {
$this->subCategories[] = $subCategory;
$subCategory->setCategoriesId($this);
}
return $this;
}
public function removeSubCategory(subCategories $subCategory): self
{
if ($this->subCategories->removeElement($subCategory)) {
// set the owning side to null (unless already changed)
if ($subCategory->getCategoriesId() === $this) {
$subCategory->setCategoriesId(null);
}
}
return $this;
}
/**
* @return Collection<int, access>
*/
public function getAccesses(): Collection
{
return $this->accesses;
}
public function addAccess(access $access): self
{
if (!$this->accesses->contains($access)) {
$this->accesses[] = $access;
$access->setCategoriesId($this);
}
return $this;
}
public function removeAccess(access $access): self
{
if ($this->accesses->removeElement($access)) {
// set the owning side to null (unless already changed)
if ($access->getCategoriesId() === $this) {
$access->setCategoriesId(null);
}
}
return $this;
}
}