Files
backend/src/Entity/Article.php
T
2026-06-03 18:38:00 +03:00

192 lines
4.3 KiB
PHP

<?php
namespace App\Entity;
use App\Entity\Behavior\UpdateTimestampTrait;
use App\Repository\ArticleRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Entity(repositoryClass: ArticleRepository::class)]
#[ORM\Table(name: 'article')]
#[ORM\Index(name: 'idx_article_region_id', columns: ['region_id'])]
#[ORM\Index(name: 'idx_article_active', columns: ['active'])]
#[ORM\HasLifecycleCallbacks]
class Article
{
use UpdateTimestampTrait;
#[Groups(['article:read'])]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: "IDENTITY")]
#[ORM\Column(type: Types::INTEGER)]
private ?int $id = null;
#[Groups(['article:read', 'article:write'])]
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $name = null;
#[Groups(['article:read', 'article:write'])]
#[ORM\Column(name: 'preview_picture', type: Types::TEXT, nullable: true)]
private ?string $previewPicture = null;
#[Groups(['article:read', 'article:write'])]
#[ORM\Column(type: Types::BOOLEAN, nullable: true)]
private ?bool $active = null;
#[Groups(['article:read', 'article:write'])]
#[ORM\Column(type: 'jsonb', nullable: true)]
private ?array $doctors = null;
#[Groups(['article:read', 'article:write'])]
#[ORM\Column(type: 'jsonb', nullable: true)]
private ?array $services = null;
#[Groups(['article:read', 'article:write'])]
#[ORM\Column(name: 'region_id', type: Types::INTEGER, nullable: true)]
private ?int $regionId = null;
#[Groups(['article:read', 'article:write'])]
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $alias = null;
#[Groups(['article:read', 'article:write'])]
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $anons = null;
#[Groups(['article:read', 'article:write'])]
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $content = null;
#[Groups(['article:read'])]
#[ORM\Column(name: 'update_at', type: Types::DATETIME_IMMUTABLE, nullable: true)]
private ?\DateTimeInterface $updateAt = null;
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): static
{
$this->name = $name;
return $this;
}
public function getPreviewPicture(): ?string
{
return $this->previewPicture;
}
public function setPreviewPicture(?string $previewPicture): static
{
$this->previewPicture = $previewPicture;
return $this;
}
public function getActive(): ?bool
{
return $this->active;
}
public function setActive(?bool $active): static
{
$this->active = $active;
return $this;
}
public function getDoctors(): ?array
{
return $this->doctors;
}
public function setDoctors(?array $doctors): static
{
$this->doctors = $doctors;
return $this;
}
public function getServices(): ?array
{
return $this->services;
}
public function setServices(?array $services): static
{
$this->services = $services;
return $this;
}
public function getRegionId(): ?int
{
return $this->regionId;
}
public function setRegionId(?int $regionId): static
{
$this->regionId = $regionId;
return $this;
}
public function getAlias(): ?string
{
return $this->alias;
}
public function setAlias(?string $alias): static
{
$this->alias = $alias;
return $this;
}
public function getAnons(): ?string
{
return $this->anons;
}
public function setAnons(?string $anons): static
{
$this->anons = $anons;
return $this;
}
public function getContent(): ?string
{
return $this->content;
}
public function setContent(?string $content): static
{
$this->content = $content;
return $this;
}
public function getUpdateAt(): ?\DateTimeInterface
{
return $this->updateAt;
}
public function setUpdateAt(?\DateTimeInterface $updateAt): static
{
$this->updateAt = $updateAt;
return $this;
}
}