<?php
namespace App\Entity;
use App\Repository\ParamCotisationRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ParamCotisationRepository::class)]
class ParamCotisation
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
#[ORM\OneToMany(mappedBy: 'paramCotisation', targetEntity: ParamCotisationParameter::class, cascade: ['persist', 'remove'], fetch: 'EXTRA_LAZY', orphanRemoval: true)]
private Collection $paramCotisationParameters;
#[ORM\Column(length: 64)]
private ?string $tag = null;
#[ORM\Column]
private ?bool $isEnabled = null;
#[ORM\Column]
private ?bool $hideInMember = null;
#[ORM\OneToMany(mappedBy: 'paramCotisation', targetEntity: ParamCotisationParamSlice::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
private Collection $paramCotisationParamSlices;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $description = null;
#[ORM\Column]
private ?int $cotisationOrder = 99;
#[ORM\Column(nullable: true)]
private ?float $maxAmount = null;
public function __construct()
{
$this->paramCotisationParameters = new ArrayCollection();
$this->paramCotisationParamSlices = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getParamCotisationParameters(): Collection
{
return $this->paramCotisationParameters;
}
public function getParamCotisationParametersByType(int $type): Collection
{
return $this->paramCotisationParameters->filter(function(ParamCotisationParameter $parameter) use ($type) {
return $parameter->getType() === $type;
});
}
public function addParamCotisationParameter(ParamCotisationParameter $paramCotisationParameter): self
{
if (!$this->paramCotisationParameters->contains($paramCotisationParameter)) {
$this->paramCotisationParameters->add($paramCotisationParameter);
$paramCotisationParameter->setParamCotisation($this);
}
return $this;
}
public function removeParamCotisationParameter(ParamCotisationParameter $paramCotisationParameter): self
{
if ($this->paramCotisationParameters->removeElement($paramCotisationParameter)) {
// set the owning side to null (unless already changed)
if ($paramCotisationParameter->getParamCotisation() === $this) {
$paramCotisationParameter->setParamCotisation(null);
}
}
return $this;
}
public function getNationalParameters(): Collection
{
return $this->paramCotisationParameters->filter(function(ParamCotisationParameter $parameter) {
return $parameter->getType() === ParamCotisationParameter::TYPE_NATIONAL_PART;
});
}
public function addNationalParameters(ParamCotisationParameter $paramCotisationParameter): self
{
if (!$this->paramCotisationParameters->contains($paramCotisationParameter)) {
$paramCotisationParameter->setType(ParamCotisationParameter::TYPE_NATIONAL_PART);
$this->paramCotisationParameters->add($paramCotisationParameter);
$paramCotisationParameter->setParamCotisation($this);
}
return $this;
}
public function removeNationalParameters(ParamCotisationParameter $paramCotisationParameter): self
{
return $this->removeParamCotisationParameter($paramCotisationParameter);
}
public function getDepartementalParameters(): Collection
{
return $this->paramCotisationParameters->filter(function(ParamCotisationParameter $parameter) {
return $parameter->getType() === ParamCotisationParameter::TYPE_DEPARTEMENTAL_PART;
});
}
public function addDepartementalParameters(ParamCotisationParameter $paramCotisationParameter): self
{
if (!$this->paramCotisationParameters->contains($paramCotisationParameter)) {
$paramCotisationParameter->setType(ParamCotisationParameter::TYPE_DEPARTEMENTAL_PART);
$this->paramCotisationParameters->add($paramCotisationParameter);
$paramCotisationParameter->setParamCotisation($this);
}
return $this;
}
public function removeDepartementalParameters(ParamCotisationParameter $paramCotisationParameter): self
{
return $this->removeParamCotisationParameter($paramCotisationParameter);
}
public function getImportExportParameters(): Collection
{
return $this->paramCotisationParameters->filter(function(ParamCotisationParameter $parameter) {
return $parameter->getType() === ParamCotisationParameter::TYPE_IMPORT_EXPORT_OPT;
});
}
public function addImportExportParameters(ParamCotisationParameter $paramCotisationParameter): self
{
if (!$this->paramCotisationParameters->contains($paramCotisationParameter)) {
$paramCotisationParameter->setType(ParamCotisationParameter::TYPE_IMPORT_EXPORT_OPT);
$this->paramCotisationParameters->add($paramCotisationParameter);
$paramCotisationParameter->setParamCotisation($this);
}
return $this;
}
public function removeImportExportParameters(ParamCotisationParameter $paramCotisationParameter): self
{
return $this->removeParamCotisationParameter($paramCotisationParameter);
}
public function getMapaParameters(): Collection
{
return $this->paramCotisationParameters->filter(function(ParamCotisationParameter $parameter) {
return $parameter->getType() === ParamCotisationParameter::TYPE_MAPA_OPT;
});
}
public function addMapaParameters(ParamCotisationParameter $paramCotisationParameter): self
{
if (!$this->paramCotisationParameters->contains($paramCotisationParameter)) {
$paramCotisationParameter->setType(ParamCotisationParameter::TYPE_MAPA_OPT);
$this->paramCotisationParameters->add($paramCotisationParameter);
$paramCotisationParameter->setParamCotisation($this);
}
return $this;
}
public function removeMapaParameters(ParamCotisationParameter $paramCotisationParameter): self
{
return $this->removeParamCotisationParameter($paramCotisationParameter);
}
public function getTag(): ?string
{
return $this->tag;
}
public function setTag(string $tag): self
{
$this->tag = $tag;
return $this;
}
public function isIsEnabled(): ?bool
{
return $this->isEnabled;
}
public function setIsEnabled(bool $isEnabled): self
{
$this->isEnabled = $isEnabled;
return $this;
}
public function getHideInMember(): ?bool
{
return $this->hideInMember;
}
public function setHideInMember(bool $hideInMember): self
{
$this->hideInMember = $hideInMember;
return $this;
}
/**
* @return Collection<int, ParamCotisationParamSlice>
*/
public function getParamCotisationParamSlices(): Collection
{
return $this->paramCotisationParamSlices;
}
public function addParamCotisationParamSlice(ParamCotisationParamSlice $paramCotisationParamSlice): self
{
if (!$this->paramCotisationParamSlices->contains($paramCotisationParamSlice)) {
$this->paramCotisationParamSlices->add($paramCotisationParamSlice);
$paramCotisationParamSlice->setParamCotisation($this);
}
return $this;
}
public function removeParamCotisationParamSlice(ParamCotisationParamSlice $paramCotisationParamSlice): self
{
if ($this->paramCotisationParamSlices->removeElement($paramCotisationParamSlice)) {
// set the owning side to null (unless already changed)
if ($paramCotisationParamSlice->getParamCotisation() === $this) {
$paramCotisationParamSlice->setParamCotisation(null);
}
}
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getCotisationOrder(): ?int
{
return $this->cotisationOrder;
}
public function setCotisationOrder(int $cotisationOrder): self
{
$this->cotisationOrder = $cotisationOrder;
return $this;
}
public function setMaxAmount(?float $amount){
$this->maxAmount = $amount;
}
public function getMaxAmount(): ?float {
return $this->maxAmount;
}
}