src/Entity/Report/ReportValue.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Report;
  3. use App\Entity\Recommendation;
  4. use App\Repository\Report\ReportValueRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9.  * @ORM\Entity(repositoryClass=ReportValueRepository::class)
  10.  */
  11. class ReportValue
  12. {
  13.   /**
  14.    * @ORM\Id
  15.    * @ORM\GeneratedValue
  16.    * @ORM\Column(type="integer")
  17.    */
  18.   private $id;
  19.   /**
  20.    * @ORM\Column(type="text", nullable=true)
  21.    */
  22.   private $norm;
  23.   /**
  24.    * @ORM\Column(type="string", length=255, nullable=true)
  25.    */
  26.   private $image;
  27.   /**
  28.    * @ORM\Column(type="text", nullable=true)
  29.    */
  30.   private $comment;
  31.   /**
  32.    * @ORM\Column(type="integer")
  33.    */
  34.   private $parameter;
  35.   /**
  36.    * @ORM\ManyToOne(targetEntity=Report::class, inversedBy="reportValues", cascade={"persist"})
  37.    */
  38.   private $report;
  39.   /**
  40.    * @ORM\Column(type="boolean", nullable=true, options={"default": false})
  41.    */
  42.   private $copyImage;
  43.   /**
  44.    * @ORM\Column(type="text", nullable=true)
  45.    */
  46.   private $coordinate;
  47.   /**
  48.    * @ORM\Column(type="string", length=255, nullable=true)
  49.    */
  50.   private $distance;
  51.   /**
  52.    * @ORM\OneToMany(targetEntity=Recommendation::class, mappedBy="reportValue",cascade={"persist","remove"})
  53.    */
  54.   private $recommendations;
  55.   /**
  56.    * @ORM\Column(type="string", length=255, nullable=true)
  57.    */
  58.   private $cropWiseLoad;
  59.   /**
  60.    * @ORM\Column(type="boolean", nullable=true)
  61.    */
  62.   private $cropWiseLoadImage;
  63.   /**
  64.    * @ORM\Column(type="integer", nullable=true)
  65.    */
  66.   private $scoutReportPointMeasurementId;
  67.   /**
  68.    * @ORM\Column(type="string", length=255, nullable=true)
  69.    */
  70.   private $ii;
  71.   /**
  72.    * @ORM\Column(type="text", nullable=true)
  73.    */
  74.   private $storageImage;
  75.     /**
  76.      * @ORM\Column(type="boolean", nullable=true, options={"default":0})
  77.      */
  78.     private $alert;
  79.   public function __construct()
  80.   {
  81.     if ($this->id === null) {
  82.       $this->copyImage false;
  83.     }
  84.     $this->recommendations = new ArrayCollection();
  85.   }
  86.   public function getId(): ?int
  87.   {
  88.     return $this->id;
  89.   }
  90.   public function getNorm(): ?string
  91.   {
  92.     return $this->norm;
  93.   }
  94.   public function setNorm(?string $norm): self
  95.   {
  96.     $this->norm $norm;
  97.     return $this;
  98.   }
  99.   public function getImage(): ?string
  100.   {
  101.     return $this->image;
  102.   }
  103.   public function setImage(?string $image): self
  104.   {
  105.     $this->image $image;
  106.     return $this;
  107.   }
  108.   public function getComment(): ?string
  109.   {
  110.     return $this->comment;
  111.   }
  112.   public function setComment(?string $comment): self
  113.   {
  114.     $this->comment $comment;
  115.     return $this;
  116.   }
  117.   public function getParameter(): ?int
  118.   {
  119.     return $this->parameter;
  120.   }
  121.   public function setParameter(int $parameter): self
  122.   {
  123.     $this->parameter $parameter;
  124.     return $this;
  125.   }
  126.   public function getReport(): ?Report
  127.   {
  128.     return $this->report;
  129.   }
  130.   public function setReport(?Report $report): self
  131.   {
  132.     $this->report $report;
  133.     return $this;
  134.   }
  135.   public function isCopyImage(): ?bool
  136.   {
  137.     return $this->copyImage;
  138.   }
  139.   public function setCopyImage(?bool $copyImage): self
  140.   {
  141.     $this->copyImage $copyImage;
  142.     return $this;
  143.   }
  144.   /**
  145.    * @return mixed
  146.    */
  147.   public function getCoordinate()
  148.   {
  149.     return $this->coordinate;
  150.   }
  151.   /**
  152.    * @param mixed $coordinate
  153.    */
  154.   public function setCoordinate($coordinate): void
  155.   {
  156.     $this->coordinate $coordinate;
  157.   }
  158.   public function getCoordinatesArray(): array
  159.   {
  160.     $coordinate str_replace('-'' '$this->coordinate);
  161.     $coordinate preg_replace('@\s+@'' '$coordinate);
  162.     $explode explode(' '$coordinate);
  163.     try {
  164.       list($lat,$lng) = $explode;
  165.       return [
  166.         'lng' => $lng,
  167.         'lat' => $lat,
  168.       ];
  169.     } catch (\Exception $e) {
  170.       return [];
  171.     }
  172.   }
  173.   /**
  174.    * @return mixed
  175.    */
  176.   public function getDistance()
  177.   {
  178.     return $this->distance;
  179.   }
  180.   /**
  181.    * @param mixed $distance
  182.    */
  183.   public function setDistance($distance): void
  184.   {
  185.     $this->distance $distance;
  186.   }
  187.   /**
  188.    * @return Collection<int, Recommendation>
  189.    */
  190.   public function getRecommendations(): Collection
  191.   {
  192.     return $this->recommendations;
  193.   }
  194.   public function addRecommendation(Recommendation $recommendation): self
  195.   {
  196.     if (!$this->recommendations->contains($recommendation)) {
  197.       $this->recommendations[] = $recommendation;
  198.       $recommendation->setReportValue($this);
  199.     }
  200.     return $this;
  201.   }
  202.   public function removeRecommendation(Recommendation $recommendation): self
  203.   {
  204.     if ($this->recommendations->removeElement($recommendation)) {
  205.       // set the owning side to null (unless already changed)
  206.       if ($recommendation->getReportValue() === $this) {
  207.         $recommendation->setReportValue(null);
  208.       }
  209.     }
  210.     return $this;
  211.   }
  212.   public function getCropWiseLoad(): ?string
  213.   {
  214.     return $this->cropWiseLoad;
  215.   }
  216.   public function setCropWiseLoad(?string $cropWiseLoad): self
  217.   {
  218.     $this->cropWiseLoad $cropWiseLoad;
  219.     return $this;
  220.   }
  221.   public function isCropWiseLoadImage(): ?bool
  222.   {
  223.     return $this->cropWiseLoadImage;
  224.   }
  225.   public function setCropWiseLoadImage(?bool $cropWiseLoadImage): self
  226.   {
  227.     $this->cropWiseLoadImage $cropWiseLoadImage;
  228.     return $this;
  229.   }
  230.   public function getScoutReportPointMeasurementId(): ?int
  231.   {
  232.     return $this->scoutReportPointMeasurementId;
  233.   }
  234.   public function setScoutReportPointMeasurementId(?int $scoutReportPointMeasurementId): self
  235.   {
  236.     $this->scoutReportPointMeasurementId $scoutReportPointMeasurementId;
  237.     return $this;
  238.   }
  239.   public function getIi(): ?string
  240.   {
  241.     return $this->ii;
  242.   }
  243.   public function setIi(?string $ii): self
  244.   {
  245.     $this->ii $ii;
  246.     return $this;
  247.   }
  248.   public function getStorageImage(): ?string
  249.   {
  250.       if(!empty($this->storageImage) && strpos($this->storageImage,'http') === false){
  251.           return $_ENV['SELECTEL_STORAGE_PUBLIC_DOMAIN']."/".$this->storageImage;
  252.       }
  253.       return $this->storageImage;
  254.   }
  255.   public function setStorageImage(?string $storageImage): self
  256.   {
  257.       $this->storageImage $storageImage;
  258.       return $this;
  259.   }
  260.     /**
  261.      * @return mixed
  262.      */
  263.     public function getAlert()
  264.     {
  265.         return $this->alert;
  266.     }
  267.     /**
  268.      * @param mixed $alert
  269.      */
  270.     public function setAlert($alert): void
  271.     {
  272.         $this->alert $alert;
  273.     }
  274. }