src/Entity/Channel/ProfessionalId/FrenchProfessionalId.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Channel\ProfessionalId;
  3. use App\Entity\Sync\SyncableInterface;
  4. use App\Enum\FrenchProfessionalLegalFormEnum;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use App\Repository\Channel\ProfessionalId\FrenchProfessionalIdRepository;
  7. use Nellapp\Bundle\SDKBundle\Channel\Entity\ProfessionalId\FrenchProfessionalIdIdInterface;
  8. use Nellapp\Bundle\SDKBundle\Channel\Entity\ProfessionalId\FrenchProfessionalIdMethodTrait;
  9. use Nellapp\Bundle\SDKBundle\Sync\EntityKeys;
  10. use Symfony\Component\Validator\Constraints as Assert;
  11. use Symfony\Component\Serializer\Annotation as Serial;
  12. #[
  13. ORM\Entity(repositoryClass: FrenchProfessionalIdRepository::class),
  14. ]
  15. class FrenchProfessionalId extends ProfessionalId implements FrenchProfessionalIdIdInterface, SyncableInterface
  16. {
  17. use FrenchProfessionalIdMethodTrait;
  18. #[ORM\Column(type: 'string', length: 14, nullable: true)]
  19. #[Assert\Length(
  20. min: 9,
  21. max: 14,
  22. minMessage: 'channel.professional_id.french.siret.Length.min',
  23. maxMessage: 'channel.professional_id.french.siret.Length.max',
  24. )]
  25. #[Assert\Luhn(
  26. message: 'channel.professional_id.french.siret.luhn'
  27. )]
  28. #[Serial\Groups(['Sync'])]
  29. private ?string $siret = null;
  30. #[ORM\Column(type: 'string', length: 20, nullable: true)]
  31. #[Assert\Choice(callback: [FrenchProfessionalLegalFormEnum::class, 'getChoices'],)]
  32. #[Serial\Groups(['Sync'])]
  33. private ?string $legalForm = null;
  34. public static function getSyncKey(): string
  35. {
  36. return EntityKeys::CHANNEL_FRENCH_PROFESSIONAL_ID;
  37. }
  38. public function getSyncDisplayLabel(): string
  39. {
  40. return 'Identifiant professionnel';
  41. }
  42. }