src/Entity/Channel/Certificate/AbstractCertificate.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Channel\Certificate;
  3. use App\Entity\Channel\Channel;
  4. use App\Repository\Channel\Certificate\AbstractCertificateRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. #[
  8. ORM\Entity(repositoryClass: AbstractCertificateRepository::class),
  9. ORM\Table(name: 'channel_certificates'),
  10. ORM\InheritanceType('JOINED'),
  11. ORM\DiscriminatorColumn(name: 'type', type: 'string'),
  12. ORM\DiscriminatorMap(['cursus-start-type' => CursusStartCertificate::class]),
  13. ]
  14. abstract class AbstractCertificate
  15. {
  16. #[ORM\Id, ORM\GeneratedValue, ORM\Column(type: 'integer')]
  17. private ?int $id = null;
  18. #[ORM\ManyToOne(targetEntity: Channel::class)]
  19. #[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')]
  20. private ?Channel $channel = null;
  21. #[ORM\Column(type: 'string', length: 255, nullable: false)]
  22. #[Assert\NotBlank()]
  23. #[Assert\Length(max: 255)]
  24. private ?string $name = null;
  25. public function getId(): ?int
  26. {
  27. return $this->id;
  28. }
  29. public function getChannel(): ?Channel
  30. {
  31. return $this->channel;
  32. }
  33. public function setChannel(?Channel $channel): static
  34. {
  35. $this->channel = $channel;
  36. return $this;
  37. }
  38. public function getName(): ?string
  39. {
  40. return $this->name;
  41. }
  42. public function setName(?string $name): static
  43. {
  44. $this->name = $name;
  45. return $this;
  46. }
  47. }