src/Entity/Channel/ChannelUserCursusPermission.php line 21

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Channel;
  3. use App\Entity\ChannelUserData\AdminChannelUserData;
  4. use App\Entity\ChannelUserData\Cursus\AbstractCursus;
  5. use App\Entity\Sync\SyncableInterface;
  6. use App\Repository\Channel\ChannelUserCursusPermissionRepository;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Drosalys\Bundle\ApiBundle\Serializer\Attributes\IdGroups;
  9. use Nellapp\Bundle\SDKBundle\Channel\Entity\ChannelUserData\AdminChannelUserDataInterface;
  10. use Nellapp\Bundle\SDKBundle\Permission\Entity\AbstractChannelUserResourcePermission;
  11. use Nellapp\Bundle\SDKBundle\Permission\Entity\ChannelResourceInterface;
  12. use Nellapp\Bundle\SDKBundle\Sync\EntityKeys;
  13. use Symfony\Component\Serializer\Annotation as Serial;
  14. #[
  15. ORM\Entity(repositoryClass: ChannelUserCursusPermissionRepository::class),
  16. ORM\Table(name: 'channel_user_cursus_permissions'),
  17. ]
  18. class ChannelUserCursusPermission extends AbstractChannelUserResourcePermission implements SyncableInterface
  19. {
  20. #[ORM\Id, ORM\GeneratedValue, ORM\Column(type: 'integer')]
  21. #[Serial\Groups(['Sync'])]
  22. protected ?int $id = null;
  23. #[ORM\ManyToOne(targetEntity: AdminChannelUserData::class)]
  24. #[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')]
  25. #[IdGroups(['Sync'])]
  26. protected ?AdminChannelUserDataInterface $channelUserData = null;
  27. #[ORM\ManyToOne(targetEntity: AbstractCursus::class)]
  28. #[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')]
  29. #[IdGroups(['Sync'])]
  30. protected ?ChannelResourceInterface $resource = null;
  31. public static function getSyncKey(): string
  32. {
  33. return EntityKeys::CHANNEL_USER_PERM_CURSUS;
  34. }
  35. public function getSyncDisplayLabel(): string
  36. {
  37. return $this->getResource() . ' - ' . $this->getChannelUserData()?->getUser();
  38. }
  39. }