<?php
namespace App\Entity;
use App\Repository\ClimatezoneRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ClimatezoneRepository::class)]
class Climatezone
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 50)]
private ?string $name = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $description = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $first_frost_at = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $last_frost_at = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $created_at = null;
#[ORM\OneToMany(mappedBy: 'climatezone', targetEntity: ClimatezoneRaster::class)]
private Collection $climatezoneRasters;
#[ORM\Column(nullable: true)]
private ?float $min_winter_temperature = null;
#[ORM\Column(nullable: true)]
private ?float $max_winter_temperature = null;
public function __construct()
{
$this->climatezoneRasters = new ArrayCollection();
$this->created_at = new \DateTime();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): static
{
$this->name = $name;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): static
{
$this->description = $description;
return $this;
}
public function getFirstFrostAt(): ?\DateTimeInterface
{
return $this->first_frost_at;
}
public function setFirstFrostAt(\DateTimeInterface $first_frost_at): static
{
$this->first_frost_at = $first_frost_at;
return $this;
}
public function getLastFrostAt(): ?\DateTimeInterface
{
return $this->last_frost_at;
}
public function setLastFrostAt(\DateTimeInterface $last_frost_at): static
{
$this->last_frost_at = $last_frost_at;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->created_at;
}
public function setCreatedAt(\DateTimeInterface $created_at): static
{
$this->created_at = $created_at;
return $this;
}
/**
* @return Collection<int, ClimatezoneRaster>
*/
public function getClimatezoneRasters(): Collection
{
return $this->climatezoneRasters;
}
public function addClimatezoneRaster(ClimatezoneRaster $climatezoneRaster): static
{
if (!$this->climatezoneRasters->contains($climatezoneRaster)) {
$this->climatezoneRasters->add($climatezoneRaster);
$climatezoneRaster->setClimatezone($this);
}
return $this;
}
public function removeClimatezoneRaster(ClimatezoneRaster $climatezoneRaster): static
{
if ($this->climatezoneRasters->removeElement($climatezoneRaster)) {
// set the owning side to null (unless already changed)
if ($climatezoneRaster->getClimatezone() === $this) {
$climatezoneRaster->setClimatezone(null);
}
}
return $this;
}
public function getMinWinterTemperature(): ?float
{
return $this->min_winter_temperature;
}
public function setMinWinterTemperature(?float $min_winter_temperature): static
{
$this->min_winter_temperature = $min_winter_temperature;
return $this;
}
public function getMaxWinterTemperature(): ?float
{
return $this->max_winter_temperature;
}
public function setMaxWinterTemperature(?float $max_winter_temperature): static
{
$this->max_winter_temperature = $max_winter_temperature;
return $this;
}
}