src/V4/Model/QuoteState/QuoteState.php line 36

Open in your IDE?
  1. <?php
  2. namespace App\V4\Model\QuoteState;
  3. use ApiPlatform\Core\Annotation\ApiProperty;
  4. use ApiPlatform\Core\Annotation\ApiResource;
  5. use App\Model\IriNormalizableInterface;
  6. use App\Model\NormalizeAsIRITrait;
  7. use App\Model\Traits\ImportableObjectTrait;
  8. use App\V4\Model\QuoteReason\QuoteReason;
  9. use Doctrine\Common\Collections\ArrayCollection;
  10. use Doctrine\Common\Collections\Collection;
  11. use Doctrine\ORM\Mapping as ORM;
  12. use Symfony\Component\Serializer\Annotation\Groups;
  13. /**
  14.  * @ApiResource(
  15.  *     attributes={
  16.  *         "denormalization_context": {
  17.  *             "api_allow_update": true
  18.  *         }
  19.  *     },
  20.  *     collectionOperations={
  21.  *         "get": {
  22.  *             "normalization_context": {
  23.  *                 "groups": {"quote_state:list"},
  24.  *                 "enable_max_depth": true
  25.  *             },
  26.  *             "security": "is_granted(constant('App\\V4\\Voters\\QuoteVoter::QUOTE_STATE_ADD_EDIT'), 'App\V4\Voters\QuoteVoter')"
  27.  *         }
  28.  *     },
  29.  *     itemOperations={
  30.  *     },
  31.  * )
  32.  */
  33. class QuoteState implements IriNormalizableInterface
  34. {
  35.     use ImportableObjectTrait;
  36.     use NormalizeAsIRITrait;
  37.     /**
  38.      * @ApiProperty(identifier=true)
  39.      *
  40.      * @var string|null
  41.      * @Groups({
  42.      *     "quote_state:list", "quote_state:read",
  43.      *     "quote:list", "quote:read"
  44.      * })
  45.      */
  46.     private $id;
  47.     /**
  48.      * @var string|null
  49.      *
  50.      * @ORM\Column(type="string", length=255)
  51.      *
  52.      * @Groups({
  53.      *     "quote_state:list",
  54.      *     "quote:list", "quote:read"
  55.      * })
  56.      */
  57.     private $name;
  58.     /**
  59.      * @var bool|null
  60.      *
  61.      * @Groups({
  62.      *     "quote_state:list",
  63.      *     "quote:list", "quote:read"
  64.      * })
  65.      */
  66.     private $inProgress;
  67.     /**
  68.      * @var bool|null
  69.      *
  70.      * @Groups({
  71.      *     "quote_state:list",
  72.      *     "quote:list", "quote:read"
  73.      * })
  74.      */
  75.     private $isWon;
  76.     /**
  77.      * @var bool|null
  78.      *
  79.      * @Groups({
  80.      *     "quote_state:list",
  81.      *     "quote:list", "quote:read"
  82.      * })
  83.      */
  84.     private $isLost;
  85.     /**
  86.      * @var bool|null
  87.      *
  88.      * @Groups({
  89.      *     "quote_state:list",
  90.      *     "quote:list", "quote:read"
  91.      * })
  92.      */
  93.     private $isAbandoned;
  94.     /**
  95.      * @var bool|null
  96.      *
  97.      * @Groups({
  98.      *     "quote_state:list",
  99.      *     "quote:list", "quote:read"
  100.      * })
  101.      */
  102.     private $isUnSelectable;
  103.     /**
  104.      * @var bool
  105.      *
  106.      * @Groups({
  107.      *     "quote_state:list",
  108.      *     "quote:list", "quote:read"
  109.      * })
  110.      */
  111.     private $isDiffered false;
  112.     /**
  113.      * @var bool
  114.      *
  115.      * @Groups({
  116.      *     "quote_state:list",
  117.      *     "quote:list", "quote:read"
  118.      * })
  119.      */
  120.     private $isNotCountForStats false;
  121.     /**
  122.      * @var string|null
  123.      *
  124.      * @Groups({
  125.      *     "quote_state:list",
  126.      *     "quote:list", "quote:read"
  127.      * })
  128.      */
  129.     private $externalId;
  130.     /**
  131.      * @var string|null
  132.      *
  133.      * @Groups({
  134.      *     "quote_state:list",
  135.      *     "quote:list", "quote:read"
  136.      * })
  137.      */
  138.     private $order;
  139.     /**
  140.      * @var bool
  141.      */
  142.     private $fromForm false;
  143.     /**
  144.      * @var QuoteReason[]|Collection
  145.      * @Groups({
  146.      *     "quote_state:list", "quote_state:read",
  147.      *     "quote:list", "quote:read"
  148.      * })
  149.      */
  150.     private $reasons;
  151.     public function __construct()
  152.     {
  153.         $this->reasons = new ArrayCollection();
  154.     }
  155.     /**
  156.      * @return string|null
  157.      */
  158.     public function getId(): ?string
  159.     {
  160.         return $this->id;
  161.     }
  162.     /**
  163.      * @param string|null $id
  164.      *
  165.      * @return QuoteState
  166.      */
  167.     public function setId(?string $id): QuoteState
  168.     {
  169.         $this->id $id;
  170.         return $this;
  171.     }
  172.     /**
  173.      * @return string|null
  174.      */
  175.     public function getName(): ?string
  176.     {
  177.         return $this->name;
  178.     }
  179.     /**
  180.      * @param string|null $name
  181.      *
  182.      * @return QuoteState
  183.      */
  184.     public function setName(?string $name): QuoteState
  185.     {
  186.         $this->name $name;
  187.         return $this;
  188.     }
  189.     /**
  190.      * @return bool|null
  191.      */
  192.     public function getIsWon(): ?bool
  193.     {
  194.         return $this->isWon;
  195.     }
  196.     /**
  197.      * @param bool|null $isWon
  198.      *
  199.      * @return QuoteState
  200.      */
  201.     public function setIsWon(?bool $isWon): QuoteState
  202.     {
  203.         $this->isWon $isWon;
  204.         return $this;
  205.     }
  206.     /**
  207.      * @return string|null
  208.      */
  209.     public function getExternalId(): ?string
  210.     {
  211.         return $this->externalId;
  212.     }
  213.     /**
  214.      * @param string|null $externalId
  215.      *
  216.      * @return QuoteState
  217.      */
  218.     public function setExternalId(?string $externalId): QuoteState
  219.     {
  220.         $this->externalId $externalId;
  221.         return $this;
  222.     }
  223.     /**
  224.      * @return string|null
  225.      */
  226.     public function getOrder(): ?string
  227.     {
  228.         return $this->order;
  229.     }
  230.     /**
  231.      * @param string|null $order
  232.      *
  233.      * @return QuoteState
  234.      */
  235.     public function setOrder(?string $order): QuoteState
  236.     {
  237.         $this->order $order;
  238.         return $this;
  239.     }
  240.     /**
  241.      * @return string
  242.      */
  243.     public function __toString(): string
  244.     {
  245.         return $this->getId();
  246.     }
  247.     /**
  248.      * @return bool
  249.      */
  250.     public function isFromForm(): bool
  251.     {
  252.         return $this->fromForm;
  253.     }
  254.     /**
  255.      * @param bool $fromForm
  256.      *
  257.      * @return QuoteState
  258.      */
  259.     public function setFromForm(bool $fromForm): QuoteState
  260.     {
  261.         $this->fromForm $fromForm;
  262.         return $this;
  263.     }
  264.     /**
  265.      * @return bool|null
  266.      */
  267.     public function getInProgress(): ?bool
  268.     {
  269.         return $this->inProgress;
  270.     }
  271.     /**
  272.      * @param bool|null $inProgress
  273.      *
  274.      * @return QuoteState
  275.      */
  276.     public function setInProgress(?bool $inProgress): QuoteState
  277.     {
  278.         $this->inProgress $inProgress;
  279.         return $this;
  280.     }
  281.     /**
  282.      * @return bool|null
  283.      */
  284.     public function getIsLost(): ?bool
  285.     {
  286.         return $this->isLost;
  287.     }
  288.     /**
  289.      * @param bool|null $isLost
  290.      *
  291.      * @return QuoteState
  292.      */
  293.     public function setIsLost(?bool $isLost): QuoteState
  294.     {
  295.         $this->isLost $isLost;
  296.         return $this;
  297.     }
  298.     /**
  299.      * @return bool|null
  300.      */
  301.     public function getIsAbandoned(): ?bool
  302.     {
  303.         return $this->isAbandoned;
  304.     }
  305.     /**
  306.      * @param bool|null $isAbandoned
  307.      *
  308.      * @return QuoteState
  309.      */
  310.     public function setIsAbandoned(?bool $isAbandoned): QuoteState
  311.     {
  312.         $this->isAbandoned $isAbandoned;
  313.         return $this;
  314.     }
  315.     /**
  316.      * @return bool|null
  317.      */
  318.     public function getIsUnSelectable(): ?bool
  319.     {
  320.         return $this->isUnSelectable;
  321.     }
  322.     /**
  323.      * @param bool|null $isUnSelectable
  324.      *
  325.      * @return QuoteState
  326.      */
  327.     public function setIsUnSelectable(?bool $isUnSelectable): self
  328.     {
  329.         $this->isUnSelectable $isUnSelectable;
  330.         return $this;
  331.     }
  332.     /**
  333.      * @return bool|null
  334.      */
  335.     public function getIsDiffered(): bool
  336.     {
  337.         return $this->isDiffered;
  338.     }
  339.     /**
  340.      * @param bool $isDiffered
  341.      *
  342.      * @return QuoteState
  343.      */
  344.     public function setIsDiffered(bool $isDiffered): self
  345.     {
  346.         $this->isDiffered $isDiffered;
  347.         return $this;
  348.     }
  349.     /**
  350.      * @return bool
  351.      */
  352.     public function isNotCountForStats(): bool
  353.     {
  354.         return $this->isNotCountForStats;
  355.     }
  356.     /**
  357.      * @param bool $isNotCountForStats
  358.      *
  359.      * @return QuoteState
  360.      */
  361.     public function setIsNotCountForStats(bool $isNotCountForStats): self
  362.     {
  363.         $this->isNotCountForStats $isNotCountForStats;
  364.         return $this;
  365.     }
  366.     /**
  367.      * @return QuoteReason[]|Collection
  368.      */
  369.     public function getReasons(): Collection
  370.     {
  371.         return $this->reasons;
  372.     }
  373.     /**
  374.      * @param QuoteReason $reason
  375.      *
  376.      * @return $this
  377.      */
  378.     public function addQuoteReason(QuoteReason $reason): self
  379.     {
  380.         if (!$this->reasons->contains($reason)) {
  381.             $this->reasons->add($reason);
  382.         }
  383.         return $this;
  384.     }
  385.     /**
  386.      * @param QuoteReason $reason
  387.      *
  388.      * @return $this
  389.      */
  390.     public function removeQuoteReason(QuoteReason $reason): self
  391.     {
  392.         if ($this->reasons->contains($reason)) {
  393.             $this->reasons->removeElement($reason);
  394.         }
  395.         return $this;
  396.     }
  397.     /**
  398.      * @param QuoteReason[]|Collection $reasons
  399.      *
  400.      * @return QuoteState
  401.      */
  402.     public function setReasons(array $reasons): self
  403.     {
  404.         $this->reasons $reasons;
  405.         return $this;
  406.     }
  407. }