<?php
namespace App\Entity\Channel\Certificate;
use App\Entity\Channel\Channel;
use App\Repository\Channel\Certificate\AbstractCertificateRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
#[
ORM\Entity(repositoryClass: AbstractCertificateRepository::class),
ORM\Table(name: 'channel_certificates'),
ORM\InheritanceType('JOINED'),
ORM\DiscriminatorColumn(name: 'type', type: 'string'),
ORM\DiscriminatorMap(['cursus-start-type' => CursusStartCertificate::class]),
]
abstract class AbstractCertificate
{
#[ORM\Id, ORM\GeneratedValue, ORM\Column(type: 'integer')]
private ?int $id = null;
#[ORM\ManyToOne(targetEntity: Channel::class)]
#[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')]
private ?Channel $channel = null;
#[ORM\Column(type: 'string', length: 255, nullable: false)]
#[Assert\NotBlank()]
#[Assert\Length(max: 255)]
private ?string $name = null;
public function getId(): ?int
{
return $this->id;
}
public function getChannel(): ?Channel
{
return $this->channel;
}
public function setChannel(?Channel $channel): static
{
$this->channel = $channel;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): static
{
$this->name = $name;
return $this;
}
}