src/Entity/CustomizableView/CustomViewCommercial.php line 21

Open in your IDE?
  1. <?php
  2. namespace App\Entity\CustomizableView;
  3. use App\Entity\Account\User;
  4. use App\Repository\CustomizableView\CustomViewCommercialRepository;
  5. use Doctrine\ORM\Mapping\Entity;
  6. use Nellapp\Bundle\SDKBundle\Entity\AbstractCustomView;
  7. use Nellapp\Bundle\SDKBundle\Permission\UserOwner\UserOwnerResourceInterface;
  8. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  9. use Doctrine\ORM\Mapping as ORM;
  10. #[Entity(repositoryClassCustomViewCommercialRepository::class)]
  11. #[ORM\Table('custom_view_commercial')]
  12. #[
  13.     UniqueEntity(
  14.         fields: ['user''name''type'],
  15.         message'You must set a unique name for your views'
  16.     ),
  17. ]
  18. class CustomViewCommercial extends AbstractCustomView implements UserOwnerResourceInterface
  19. {
  20.     const LICENSES_VIEW 'licenses_view';
  21.     const LICENSES_ORDER_VIEW 'licenses_order_view';
  22.     #[ORM\IdORM\GeneratedValueORM\Column(type'integer')]
  23.     private ?int $id null;
  24.     #[ORM\ManyToOne(targetEntityUser::class)]
  25.     #[ORM\JoinColumn(nullablefalseonDelete'CASCADE')]
  26.     private ?User $user null;
  27.     #[ORM\Column(type'string'nullablefalse)]
  28.     private ?string $type null;
  29.     function getId(): ?int
  30.     {
  31.         return $this->id;
  32.     }
  33.     public function getUser(): ?User
  34.     {
  35.         return $this->user;
  36.     }
  37.     public function setUser(?User $user): static
  38.     {
  39.         $this->user $user;
  40.         return $this;
  41.     }
  42.     public function getType(): ?string
  43.     {
  44.         return $this->type;
  45.     }
  46.     public function setType(?string $type): static
  47.     {
  48.         $this->type $type;
  49.         return $this;
  50.     }
  51.     public function getUserOwners(): array
  52.     {
  53.         return [
  54.             $this->getUser(),
  55.         ];
  56.     }
  57. }