src/Domain/Entity/PointOfInterest/CampingInformation.php line 27

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\Domain\Entity\Behavior\Identifiable;
  8. use Gedmo\SoftDeleteable\Traits\SoftDeleteable;
  9. use Gedmo\Timestampable\Traits\Timestampable;
  10. /**
  11.  * Class CampingInformation
  12.  *
  13.  * @package App\Domain\Entity\PointOfInterest
  14.  */
  15. #[ApiResource(
  16.     operations            : [
  17.         new Get(),
  18.         new GetCollection(),
  19.         new Post(),
  20.     ],
  21.     normalizationContext  : ['groups' => ['camping_information_read']],
  22.     denormalizationContext: ['groups' => ['camping_information_write']]
  23. )]
  24. class CampingInformation
  25. {
  26.     use Identifiable;
  27.     use SoftDeleteable;
  28.     use Timestampable;
  29.     public function __construct(
  30.         public ?bool $animal null,
  31.         public ?bool $barbecue null,
  32.         public ?bool $ccPassage null,
  33.         public ?bool $ffcAdvantage null,
  34.         public ?string $ffcAdvantageDescription null,
  35.         public ?bool $mandatoryParking null,
  36.         public ?int $minimumSleep null,
  37.         public ?bool $naturist null,
  38.         public ?int $notation null,
  39.         public ?bool $stopWelcome null,
  40.         public ?string $stopWelcomeDescription null,
  41.         public ?string $surface null,
  42.     ) {}
  43.     public function getNotationString(): string null
  44.     {
  45.         if (!$this->notation) {
  46.             return $this->notation;
  47.         }
  48.         return str_repeat('*'$this->notation);
  49.     }
  50. }