src/Domain/Entity/PointOfInterest/ContactInformation.php line 28

Open in your IDE?
  1. <?php
  2. namespace App\Domain\Entity\PointOfInterest;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use ApiPlatform\Metadata\Get;
  5. use ApiPlatform\Metadata\GetCollection;
  6. use ApiPlatform\Metadata\Post;
  7. use App\Application\Service\URLService;
  8. use App\Domain\Entity\Behavior\Identifiable;
  9. use Gedmo\SoftDeleteable\Traits\SoftDeleteable;
  10. use Gedmo\Timestampable\Traits\Timestampable;
  11. /**
  12.  * Class Information
  13.  *
  14.  * @package App\Domain\Entity\PointOfInterest
  15.  */
  16. #[ApiResource(
  17.     operations            : [
  18.         new Get(),
  19.         new GetCollection(),
  20.         new Post(),
  21.     ],
  22.     normalizationContext  : ['groups' => ['contact_information_read']],
  23.     denormalizationContext: ['groups' => ['contact_information_write']]
  24. )]
  25. class ContactInformation
  26. {
  27.     use Identifiable;
  28.     use SoftDeleteable;
  29.     use Timestampable;
  30.     public function __construct(
  31.         public ?string $cityHall null,
  32.         public ?string $email null,
  33.         public ?string $email2 null,
  34.         public ?string $facebook null,
  35.         public ?string $instagram null,
  36.         public ?string $policeOffice null,
  37.         public ?string $referentName null,
  38.         public ?string $telephone null,
  39.         public ?string $telephone2 null,
  40.         public ?string $touristOffice null,
  41.         public ?string $twitter null,
  42.         public ?string $website null,
  43.         public ?string $website2 null,
  44.     ) {
  45.         $this->website URLService::formatUrl($this->website);
  46.         $this->website2 URLService::formatUrl($this->website2);
  47.     }
  48.     public function setWebsite(?string $url): void
  49.     {
  50.         $this->website URLService::formatUrl($url);
  51.     }
  52.     public function setWebsite2(?string $url): void
  53.     {
  54.         $this->website2 URLService::formatUrl($url);
  55.     }
  56. }