src/Entity/AFrameRoom.php line 61

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Annotation\EsUploadable;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use App\Repository\AFrameRoomRepository;
  6. use ApiPlatform\Core\Annotation\ApiFilter;
  7. use App\Entity\Traits\TimestampableEntity;
  8. use Doctrine\Common\Collections\Collection;
  9. use ApiPlatform\Core\Annotation\ApiResource;
  10. use App\Entity\Interfaces\UploadMappedInterface;
  11. use Doctrine\Common\Collections\ArrayCollection;
  12. use App\Entity\Interfaces\ContainerMappedInterface;
  13. use Symfony\Component\Serializer\Annotation\Groups;
  14. use Symfony\Component\Validator\Constraints as Assert;
  15. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
  16. /**
  17.  * @ApiResource(
  18.  *      attributes={"security"="is_granted('ROLE_OPERATOR')"},
  19.  *      normalizationContext={"groups"={"AFrameRoom:Read"}, "skip_null_values"=false},
  20.  *      denormalizationContext={"groups"={"AFrameRoom:Write"}},
  21.  *      collectionOperations={
  22.  *          "post",
  23.  *          "get",
  24.  *          "get_aframe"={
  25.  *              "route_name"="api_aframe_a3d",
  26.  *              "security"="is_granted('IS_AUTHENTICATED_FULLY')",
  27.  *              "method"="GET",
  28.  *               "openapi_context" = {
  29.  *                  "parameters" = {
  30.  *                      {
  31.  *                          "name" = "locale",
  32.  *                          "in" = "query",
  33.  *                          "description" = "Enter locale",
  34.  *                          "schema" = {
  35.  *                              "type" = "string"
  36.  *                          }
  37.  *                      }
  38.  *                  }
  39.  *               }
  40.  *          },
  41.  *      },
  42.  *      itemOperations={
  43.  *          "get"={"security"="is_granted('IS_CO_OPR', object)"},
  44.  *          "put"={"security"="is_granted('IS_CO_OPR', object)"},
  45.  *          "patch"={"security"="is_granted('IS_CO_OPR', object)"},
  46.  *          "delete"={"security"="is_granted('IS_CO_OPR', object)"},
  47.  *          "patch_set_default"={
  48.  *              "route_name"="api_aframeroom_set_default_collection",
  49.  *              "method"="PATCH",
  50.  *              "denormalization_context"={"groups"={"AFrameRoom:SetDefault"}},
  51.  *              "security"="is_granted('IS_CO_OPR', object)"
  52.  *          },
  53.  *      }
  54.  * )
  55.  * @ApiFilter(SearchFilter::class, properties={"container.id": "exact", "name": "partial"})
  56.  * @ORM\Entity(repositoryClass=AFrameRoomRepository::class)
  57.  */
  58. class AFrameRoom implements ContainerMappedInterfaceUploadMappedInterface
  59. {
  60.     /**
  61.      * Hook timestampable behavior
  62.      * updates createdAt, updatedAt fields
  63.      */
  64.     use TimestampableEntity;
  65.     /**
  66.      * @ORM\Id
  67.      * @ORM\GeneratedValue
  68.      * @ORM\Column(type="integer")
  69.      * @Groups({"AFrameRoom:Read"})
  70.      */
  71.     private $id;
  72.     /**
  73.      * @ORM\Column(type="string", length=255)
  74.      * @Groups({"AFrameRoom:Read", "AFrameRoom:Write"})
  75.      * 
  76.      * @Assert\NotBlank()
  77.      * @Assert\Length(max=255, maxMessage="validation.aFrameRoom:name.max")
  78.      */
  79.     private $name;
  80.     /**
  81.      * @ORM\Column(type="string", length=255, nullable=true)
  82.      * @Groups({"AFrameRoom:Read", "AFrameRoom:Write"})
  83.      * 
  84.      * @Assert\Length(max=255, maxMessage="validation.aFrameRoom:image.max")
  85.      * @EsUploadable()
  86.      */
  87.     protected $image;
  88.     /**
  89.      * @ORM\Column(type="decimal", precision=10, scale=3)
  90.      * @Groups({"AFrameRoom:Read", "AFrameRoom:Write"})
  91.      * 
  92.      * @Assert\NotBlank()
  93.      * @Assert\Regex(pattern="/^-?\d{1,7}+(\.\d{1,3}+)?$/", message="validation.aFrameRoom:camPosX.decimal")
  94.      */
  95.     private $camPosX;
  96.     /**
  97.      * @ORM\Column(type="decimal", precision=10, scale=3)
  98.      * @Groups({"AFrameRoom:Read", "AFrameRoom:Write"})
  99.      * 
  100.      * @Assert\NotBlank()
  101.      * @Assert\Regex(pattern="/^-?\d{1,7}+(\.\d{1,3}+)?$/", message="validation.aFrameRoom:camPosY.decimal")
  102.      */
  103.     private $camPosY;
  104.     /**
  105.      * @ORM\Column(type="decimal", precision=10, scale=3)
  106.      * @Groups({"AFrameRoom:Read", "AFrameRoom:Write"})
  107.      * 
  108.      * @Assert\NotBlank()
  109.      * @Assert\Regex(pattern="/^-?\d{1,7}+(\.\d{1,3}+)?$/", message="validation.aFrameRoom:camPosZ.decimal")
  110.      */
  111.     private $camPosZ;
  112.     /**
  113.      * @ORM\Column(type="decimal", precision=10, scale=3)
  114.      * @Groups({"AFrameRoom:Read", "AFrameRoom:Write"})
  115.      * 
  116.      * @Assert\NotBlank()
  117.      * @Assert\Regex(pattern="/^-?\d{1,7}+(\.\d{1,3}+)?$/", message="validation.aFrameRoom:camRotX.decimal")
  118.      */
  119.     private $camRotX;
  120.     /**
  121.      * @ORM\Column(type="decimal", precision=10, scale=3)
  122.      * @Groups({"AFrameRoom:Read", "AFrameRoom:Write"})
  123.      * 
  124.      * @Assert\NotBlank()
  125.      * @Assert\Regex(pattern="/^-?\d{1,7}+(\.\d{1,3}+)?$/", message="validation.aFrameRoom:camRotY.decimal")
  126.      */
  127.     private $camRotY;
  128.     /**
  129.      * @ORM\Column(type="decimal", precision=10, scale=3)
  130.      * @Groups({"AFrameRoom:Read", "AFrameRoom:Write"})
  131.      * 
  132.      * @Assert\NotBlank()
  133.      * @Assert\Regex(pattern="/^-?\d{1,7}+(\.\d{1,3}+)?$/", message="validation.aFrameRoom:camRotZ.decimal")
  134.      */
  135.     private $camRotZ;
  136.     /**
  137.      * @ORM\Column(type="boolean", nullable=true)
  138.      * @Groups({"AFrameRoom:Read", "AFrameRoom:Write"})
  139.      * 
  140.      * @Assert\Type("bool")
  141.      */
  142.     private $isEntryRoom;
  143.     /**
  144.      * @ORM\ManyToOne(targetEntity=Container::class, inversedBy="aFrameRooms")
  145.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  146.      * @Groups({"AFrameRoom:Read", "AFrameRoom:Write"})
  147.      */
  148.     private $container;
  149.     /**
  150.      * @ORM\OneToMany(targetEntity=AFramePanel::class, mappedBy="aFrameRoom", orphanRemoval=true)
  151.      */
  152.     private $aFramePanels;
  153.     /**
  154.      * @ORM\Column(type="boolean", nullable=true)
  155.      * @Groups({"AFrameRoom:Read", "AFrameRoom:Write"})
  156.      */
  157.     private $isRotateEnable true;
  158.     /**
  159.      * @ORM\Column(type="boolean", nullable=true)
  160.      * @Groups({"AFrameRoom:Read", "AFrameRoom:Write"})
  161.      */
  162.     private $isShowTurnArrows;
  163.     /**
  164.      * @ORM\Column(type="decimal", precision=10, scale=3, nullable=true)
  165.      * @Groups({"AFrameRoom:Read", "AFrameRoom:Write"})
  166.      */
  167.     private $turnLeftAngle;
  168.     /**
  169.      * @ORM\Column(type="decimal", precision=10, scale=3, nullable=true)
  170.      * @Groups({"AFrameRoom:Read", "AFrameRoom:Write"})
  171.      */
  172.     private $turnRightAngle;
  173.     /**
  174.      * @ORM\Column(type="boolean", nullable=true)
  175.      * @Groups({"AFrameRoom:Read", "AFrameRoom:Write"})
  176.      */
  177.     private $isRestrictLateralMovement;
  178.     /**
  179.      * @ORM\Column(type="decimal", precision=10, scale=3, nullable=true)
  180.      * @Groups({"AFrameRoom:Read", "AFrameRoom:Write"})
  181.      */
  182.     private $lateralAngleRange;
  183.     /**
  184.      * @ORM\Column(type="boolean", nullable=true)
  185.      * @Groups({"AFrameRoom:Read", "AFrameRoom:Write"})
  186.      */
  187.     private $isRestrictPolarMovement;
  188.     /**
  189.      * @ORM\Column(type="decimal", precision=10, scale=3, nullable=true)
  190.      * @Groups({"AFrameRoom:Read", "AFrameRoom:Write"})
  191.      */
  192.     private $polarAngleRange;
  193.     public function __construct()
  194.     {
  195.         $this->aFramePanels = new ArrayCollection();
  196.     }
  197.     public function getId(): ?int
  198.     {
  199.         return $this->id;
  200.     }
  201.     public function getName(): ?string
  202.     {
  203.         return $this->name;
  204.     }
  205.     public function setName(string $name): self
  206.     {
  207.         $this->name $name;
  208.         return $this;
  209.     }
  210.     public function getImage(): ?string
  211.     {
  212.         return $this->image;
  213.     }
  214.     public function setImage(?string $image): self
  215.     {
  216.         $this->image $image;
  217.         return $this;
  218.     }
  219.     public function getCamPosX(): ?string
  220.     {
  221.         return $this->camPosX;
  222.     }
  223.     public function setCamPosX(string $camPosX): self
  224.     {
  225.         $this->camPosX $camPosX;
  226.         return $this;
  227.     }
  228.     public function getCamPosY(): ?string
  229.     {
  230.         return $this->camPosY;
  231.     }
  232.     public function setCamPosY(string $camPosY): self
  233.     {
  234.         $this->camPosY $camPosY;
  235.         return $this;
  236.     }
  237.     public function getCamPosZ(): ?string
  238.     {
  239.         return $this->camPosZ;
  240.     }
  241.     public function setCamPosZ(string $camPosZ): self
  242.     {
  243.         $this->camPosZ $camPosZ;
  244.         return $this;
  245.     }
  246.     public function getCamRotX(): ?string
  247.     {
  248.         return $this->camRotX;
  249.     }
  250.     public function setCamRotX(string $camRotX): self
  251.     {
  252.         $this->camRotX $camRotX;
  253.         return $this;
  254.     }
  255.     public function getCamRotY(): ?string
  256.     {
  257.         return $this->camRotY;
  258.     }
  259.     public function setCamRotY(string $camRotY): self
  260.     {
  261.         $this->camRotY $camRotY;
  262.         return $this;
  263.     }
  264.     public function getCamRotZ(): ?string
  265.     {
  266.         return $this->camRotZ;
  267.     }
  268.     public function setCamRotZ(string $camRotZ): self
  269.     {
  270.         $this->camRotZ $camRotZ;
  271.         return $this;
  272.     }
  273.     public function getIsEntryRoom(): ?bool
  274.     {
  275.         return $this->isEntryRoom;
  276.     }
  277.     public function setIsEntryRoom(?bool $isEntryRoom): self
  278.     {
  279.         $this->isEntryRoom $isEntryRoom;
  280.         return $this;
  281.     }
  282.     public function getContainer(): ?Container
  283.     {
  284.         return $this->container;
  285.     }
  286.     public function setContainer(?Container $container): self
  287.     {
  288.         $this->container $container;
  289.         return $this;
  290.     }
  291.     /**
  292.      * @return Collection|AFramePanel[]
  293.      */
  294.     public function getAFramePanels(): Collection
  295.     {
  296.         return $this->aFramePanels;
  297.     }
  298.     public function addAFramePanel(AFramePanel $aFramePanel): self
  299.     {
  300.         if (!$this->aFramePanels->contains($aFramePanel)) {
  301.             $this->aFramePanels[] = $aFramePanel;
  302.             $aFramePanel->setAFrameRoom($this);
  303.         }
  304.         return $this;
  305.     }
  306.     public function removeAFramePanel(AFramePanel $aFramePanel): self
  307.     {
  308.         if ($this->aFramePanels->removeElement($aFramePanel)) {
  309.             // set the owning side to null (unless already changed)
  310.             if ($aFramePanel->getAFrameRoom() === $this) {
  311.                 $aFramePanel->setAFrameRoom(null);
  312.             }
  313.         }
  314.         return $this;
  315.     }
  316.     public function getIsRotateEnable(): ?bool
  317.     {
  318.         return $this->isRotateEnable;
  319.     }
  320.     public function setIsRotateEnable(?bool $isRotateEnable): self
  321.     {
  322.         $this->isRotateEnable $isRotateEnable;
  323.         return $this;
  324.     }
  325.     public function getIsShowTurnArrows(): ?bool
  326.     {
  327.         return $this->isShowTurnArrows;
  328.     }
  329.     public function setIsShowTurnArrows(?bool $isShowTurnArrows): self
  330.     {
  331.         $this->isShowTurnArrows $isShowTurnArrows;
  332.         return $this;
  333.     }
  334.     public function getTurnLeftAngle(): ?string
  335.     {
  336.         return $this->turnLeftAngle;
  337.     }
  338.     public function setTurnLeftAngle(?string $turnLeftAngle): self
  339.     {
  340.         $this->turnLeftAngle $turnLeftAngle;
  341.         return $this;
  342.     }
  343.     public function getTurnRightAngle(): ?string
  344.     {
  345.         return $this->turnRightAngle;
  346.     }
  347.     public function setTurnRightAngle(?string $turnRightAngle): self
  348.     {
  349.         $this->turnRightAngle $turnRightAngle;
  350.         return $this;
  351.     }
  352.     public function getIsRestrictLateralMovement(): ?bool
  353.     {
  354.         return $this->isRestrictLateralMovement;
  355.     }
  356.     public function setIsRestrictLateralMovement(?bool $isRestrictLateralMovement): self
  357.     {
  358.         $this->isRestrictLateralMovement $isRestrictLateralMovement;
  359.         return $this;
  360.     }
  361.     public function getLateralAngleRange(): ?string
  362.     {
  363.         return $this->lateralAngleRange;
  364.     }
  365.     public function setLateralAngleRange(?string $lateralAngleRange): self
  366.     {
  367.         $this->lateralAngleRange $lateralAngleRange;
  368.         return $this;
  369.     }
  370.     public function getIsRestrictPolarMovement(): ?bool
  371.     {
  372.         return $this->isRestrictPolarMovement;
  373.     }
  374.     public function setIsRestrictPolarMovement(?bool $isRestrictPolarMovement): self
  375.     {
  376.         $this->isRestrictPolarMovement $isRestrictPolarMovement;
  377.         return $this;
  378.     }
  379.     public function getPolarAngleRange(): ?string
  380.     {
  381.         return $this->polarAngleRange;
  382.     }
  383.     public function setPolarAngleRange(?string $polarAngleRange): self
  384.     {
  385.         $this->polarAngleRange $polarAngleRange;
  386.         return $this;
  387.     }
  388. }