<?php
namespace App\Entity;
use App\Repository\CategoryRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use App\Entity\Service;
/**
* @ORM\Entity(repositoryClass=CategoryRepository::class)
*/
class Category
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $title;
/**
* @ORM\OneToMany(targetEntity=Service::class, mappedBy="category")
*/
private $services;
/**
* @ORM\OneToMany(targetEntity=User::class, mappedBy="category")
*/
private $users;
/**
* @ORM\Column(type="text")
*/
private $content;
/**
* @ORM\Column(type="string", length=255)
*/
private $picture;
/**
* @ORM\Column(type="datetime",nullable=true)
*/
private $created_At;
/**
* @ORM\Column(type="datetime",nullable=true)
*/
private $updated_At;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $deleted_At;
public function __construct()
{
$this->services = new ArrayCollection();
$this->users = new ArrayCollection();
}
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;
}
/**
* @return Collection<int, Service>
*/
public function getServices(): Collection
{
return $this->services;
}
public function addService(Service $service): self
{
if (!$this->services->contains($service)) {
$this->services[] = $service;
$service->setCategory($this);
}
return $this;
}
public function removeService(Service $service): self
{
if ($this->services->removeElement($service)) {
// set the owning side to null (unless already changed)
if ($service->getCategory() === $this) {
$service->setCategory(null);
}
}
return $this;
}
public function __toString()
{
return $this->title;
}
/**
* @return Collection<int, User>
*/
public function getUsers(): Collection
{
return $this->users;
}
public function addUser(User $user): self
{
if (!$this->users->contains($user)) {
$this->users[] = $user;
$user->setCategory($this);
}
return $this;
}
public function removeUser(User $user): self
{
if ($this->users->removeElement($user)) {
// set the owning side to null (unless already changed)
if ($user->getCategory() === $this) {
$user->setCategory(null);
}
}
return $this;
}
public function getContent(): ?string
{
return $this->content;
}
public function setContent(string $content): self
{
$this->content = $content;
return $this;
}
public function getPicture(): ?string
{
return $this->picture;
}
public function setPicture(string $picture): self
{
$this->picture = $picture;
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;
}
public function getDeletedAt(): ?\DateTimeInterface
{
return $this->deleted_At;
}
public function setDeletedAt(?\DateTimeInterface $deleted_At): self
{
$this->deleted_At = $deleted_At;
return $this;
}
}