<?php
namespace App\Entity;
use App\Repository\NewsCategoryRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass=NewsCategoryRepository::class)
*/
class NewsCategory
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="boolean")
*/
private bool $enabled = false;
/**
* @Assert\NotBlank
* @ORM\Column(type="string", length=255)
*/
private string $name;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private ?\DateTime $createdAt;
public function __construct()
{
$this->createdAt = new \DateTime();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function __toString()
{
return $this->name;
}
public function isEnabled(): bool
{
return $this->enabled;
}
public function setEnabled(bool $enabled): void
{
$this->enabled = $enabled;
}
}