src/V4/Model/Naf/Naf.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\V4\Model\Naf;
  3. use App\Model\IriNormalizableInterface;
  4. use App\Model\NormalizeAsIRITrait;
  5. use App\Model\Traits\ImportableObjectTrait;
  6. use Symfony\Component\Serializer\Annotation\Groups;
  7. class Naf implements IriNormalizableInterface
  8. {
  9.     use ImportableObjectTrait;
  10.     use NormalizeAsIRITrait;
  11.     /**
  12.      * @var string
  13.      *
  14.      * @Groups({
  15.      *     "prospect:list", "prospect:read", "prospect:write", "prospect:update"
  16.      * })
  17.      */
  18.     private $id;
  19.     /**
  20.      * @var string|null
  21.      *
  22.      * @Groups({
  23.      *     "prospect:list", "prospect:read", "prospect:write", "prospect:update"
  24.      * })
  25.      */
  26.     private $code;
  27.     /**
  28.      * @var string|null
  29.      * @Groups({
  30.      *     "prospect:list", "prospect:read", "prospect:write", "prospect:update"
  31.      * })
  32.      */
  33.     private $label;
  34.     /**
  35.      * @var bool
  36.      */
  37.     private $fromForm false;
  38.     public function getFullLabel(): string
  39.     {
  40.         return "{$this->getCode()} - {$this->getLabel()}";
  41.     }
  42.     /**
  43.      * @return string
  44.      */
  45.     public function getId(): string
  46.     {
  47.         return $this->id;
  48.     }
  49.     /**
  50.      * @param string $id
  51.      *
  52.      * @return Naf
  53.      */
  54.     public function setId(string $id): Naf
  55.     {
  56.         $this->id $id;
  57.         return $this;
  58.     }
  59.     /**
  60.      * @return string|null
  61.      */
  62.     public function getCode(): ?string
  63.     {
  64.         return $this->code;
  65.     }
  66.     /**
  67.      * @param string|null $code
  68.      *
  69.      * @return Naf
  70.      */
  71.     public function setCode(?string $code): Naf
  72.     {
  73.         $this->code $code;
  74.         return $this;
  75.     }
  76.     /**
  77.      * @return string|null
  78.      */
  79.     public function getLabel(): ?string
  80.     {
  81.         return $this->label;
  82.     }
  83.     /**
  84.      * @param string|null $label
  85.      *
  86.      * @return Naf
  87.      */
  88.     public function setLabel(?string $label): Naf
  89.     {
  90.         $this->label $label;
  91.         return $this;
  92.     }
  93.     /**
  94.      * For setting up the default value in ChoiceType in the edit form.
  95.      *
  96.      * @return string
  97.      */
  98.     public function __toString(): string
  99.     {
  100.         return $this->getId();
  101.     }
  102.     /**
  103.      * @return bool
  104.      */
  105.     public function isFromForm(): bool
  106.     {
  107.         return $this->fromForm;
  108.     }
  109.     /**
  110.      * @param bool $fromForm
  111.      *
  112.      * @return Naf
  113.      */
  114.     public function setFromForm(bool $fromForm): Naf
  115.     {
  116.         $this->fromForm $fromForm;
  117.         return $this;
  118.     }
  119. }