src/Entity/Channel/ChannelUserServicePermission.php line 20

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