src/Entity/Location.php line 204

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\LocationRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use JsonSerializable;
  9. /**
  10.  * @ORM\Entity(repositoryClass=LocationRepository::class)
  11.  */
  12. class Location implements JsonSerializable
  13. {
  14.     const TYPE_FIELD 'TYPE_FIELD'#Potrero
  15.     const TYPE_PEN 'TYPE_PEN'# Corral
  16.     const PASTURA_ALFAFA 'PASTURA_ALFAFA';
  17.     const PASTURA_FESTUCA 'PASTURA_FESTUCA';
  18.     const PASTURA_AGRORIO 'PASTURA_AGRORIO';
  19.     const CAMPO_NATURAL 'CAMPO_NATURAL';
  20.     const VERDEO_AVENA 'VERDEO_AVENA';
  21.     const VERDEO_CEBADA 'VERDEO_CEBADA';
  22.     const VERDEO_CENTENO 'VERDEO_CENTENO';
  23.     const VERDEO_TRITICALE 'VERDEO_TRITICALE';
  24.     const VERDEO_SORGO 'VERDEO_SORGO';
  25.     const VERDEO_MOHA 'VERDEO_MOHA';
  26.     const VERDEO_MIJO 'VERDEO_MIJO';
  27.     /**
  28.      * @ORM\Id
  29.      * @ORM\GeneratedValue
  30.      * @ORM\Column(type="integer")
  31.      */
  32.     private $id;
  33.     /**
  34.      * @ORM\Column(type="string", length=255)
  35.      */
  36.     private $name;
  37.     /**
  38.      * @ORM\Column(type="string", length=255)
  39.      */
  40.     private $type;
  41.     /**
  42.      * @ORM\Column(type="integer", nullable=true)
  43.      */
  44.     private $hectares;
  45.     /**
  46.      * @ORM\Column(type="string", length=255, nullable=true)
  47.      */
  48.     private $observation;
  49.     /**
  50.      * @ORM\Column(type="boolean", nullable=true)
  51.      */
  52.     private $deleted false;
  53.     /**
  54.      * @ORM\Column(type="datetime", nullable=false)
  55.      */
  56.     private $created;
  57.     /**
  58.      * Many locations have one farm
  59.      * @ORM\ManyToOne(targetEntity="Farm", inversedBy="locations")
  60.      * @ORM\JoinColumn(name="farm_id", referencedColumnName="id")
  61.      */
  62.     private $farm;
  63.     /**
  64.      * @ORM\Column(type="text", nullable=true)
  65.      */
  66.     private $mapDraw;
  67.     /**
  68.      * @ORM\Column(type="array", nullable=true)
  69.      */
  70.     private $resource;
  71.     /**
  72.      * @ORM\Column(type="string", length=255, nullable=true)
  73.      */
  74.     private $foodRation;
  75.     /**
  76.      * @ORM\Column(type="string", length=255, nullable=true, options={"default" : "#57a617"})
  77.      */
  78.     private $color;
  79.     public function __construct()
  80.     {
  81.         $this->created = new \DateTime();
  82.     }
  83.     public function getId(): ?int
  84.     {
  85.         return $this->id;
  86.     }
  87.     public function getName(): ?string
  88.     {
  89.         return $this->name;
  90.     }
  91.     public function setName(string $name): self
  92.     {
  93.         $this->name $name;
  94.         return $this;
  95.     }
  96.     public function getType(): ?string
  97.     {
  98.         return $this->type;
  99.     }
  100.     public function setType(string $type): self
  101.     {
  102.         $this->type $type;
  103.         return $this;
  104.     }
  105.     public function getHectares(): ?int
  106.     {
  107.         return $this->hectares;
  108.     }
  109.     public function setHectares(?int $hectares): self
  110.     {
  111.         $this->hectares $hectares;
  112.         return $this;
  113.     }
  114.     public function getObservation(): ?string
  115.     {
  116.         return $this->observation;
  117.     }
  118.     public function setObservation(?string $observation): self
  119.     {
  120.         $this->observation $observation;
  121.         return $this;
  122.     }
  123.     public function getDeleted(): ?bool
  124.     {
  125.         return $this->deleted;
  126.     }
  127.     public function setDeleted(?bool $deleted): self
  128.     {
  129.         $this->deleted $deleted;
  130.         return $this;
  131.     }
  132.     public function getCreated(): ?\DateTimeInterface
  133.     {
  134.         return $this->created;
  135.     }
  136.     public function setCreated(\DateTimeInterface $created): self
  137.     {
  138.         $this->created $created;
  139.         return $this;
  140.     }
  141.     public function getMapDraw(): ?string
  142.     {
  143.         return $this->mapDraw;
  144.     }
  145.     public function setMapDraw(?string $mapDraw): self
  146.     {
  147.         $this->mapDraw $mapDraw;
  148.         return $this;
  149.     }
  150.     public function getFarm(): ?Farm
  151.     {
  152.         return $this->farm;
  153.     }
  154.     public function setFarm(?Farm $farm): self
  155.     {
  156.         $this->farm $farm;
  157.         return $this;
  158.     }
  159.     public function jsonSerialize()
  160.     {
  161.         return array(
  162.             'id' => $this->id,
  163.             'name' => $this->name,
  164.             'mapDraw' => $this->mapDraw,
  165.         );
  166.     }
  167.     public function __toString()
  168.     {
  169.         return $this->name;
  170.     }
  171.     public function getResource(): ?array
  172.     {
  173.         return $this->resource;
  174.     }
  175.     public function setResource(?array $resource): self
  176.     {
  177.         $this->resource $resource;
  178.         return $this;
  179.     }
  180.     public function getFoodRation(): ?string
  181.     {
  182.         return $this->foodRation;
  183.     }
  184.     public function setFoodRation(?string $foodRation): self
  185.     {
  186.         $this->foodRation $foodRation;
  187.         return $this;
  188.     }
  189.     /**
  190.      * @return mixed
  191.      */
  192.     public function getColor()
  193.     {
  194.         return $this->color;
  195.     }
  196.     /**
  197.      * @param mixed $color
  198.      */
  199.     public function setColor($color): void
  200.     {
  201.         $this->color $color;
  202.     }
  203.     public function isDeleted(): ?bool
  204.     {
  205.         return $this->deleted;
  206.     }
  207. }