<?php
namespace App\Entity\System;
use App\Repository\System\subCategoriesRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: subCategoriesRepository::class)]
class subCategories
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\ManyToOne(inversedBy: 'subCategories', targetEntity: categories::class)]
private $categories_id;
#[ORM\Column(type: 'string',length: 255, nullable: true)]
private $title;
#[ORM\Column(type: 'string',length: 255, 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: 'sub_categories', targetEntity: permissions::class)]
private $permissions;
public function __construct()
{
$this->permissions = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function setId(?int $id): self
{
$this->id = $id;
return $this;
}
public function getCategoriesId(): ?categories
{
return $this->categories_id;
}
public function setCategoriesId(?categories $categories_id): self
{
$this->categories_id = $categories_id;
return $this;
}
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, permissions>
*/
public function getPermissions(): Collection
{
return $this->permissions;
}
public function addPermission(permissions $permission): self
{
if (!$this->permissions->contains($permission)) {
$this->permissions[] = $permission;
$permission->setSubCategoriesId($this);
}
return $this;
}
public function removePermission(permissions $permission): self
{
if ($this->permissions->removeElement($permission)) {
// set the owning side to null (unless already changed)
if ($permission->getSubCategoriesId() === $this) {
$permission->setSubCategoriesId(null);
}
}
return $this;
}
}