Taxe.php 2,26 ko
Newer Older
NOPepin's avatar
NOPepin a validé
<?php

namespace App\Entity;

use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\ApiFilter;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
use ApiPlatform\Doctrine\Orm\Filter\RangeFilter;
NOPepin's avatar
NOPepin a validé
use App\Repository\TaxeRepository;
use Doctrine\ORM\Mapping as ORM;

#[ORM\Entity(repositoryClass: TaxeRepository::class)]
#[ApiResource(
    operations: [
        new Get(),
        new GetCollection()
    ],
    paginationClientEnabled: true
)]
#[ApiFilter(SearchFilter::class, properties: [
    'type' => 'exact',
    'type.code' => 'exact',
    'annee' => 'exact',
    'commune.departement' => 'exact'
])]
#[ApiFilter(RangeFilter::class, properties: ['annee'])]
NOPepin's avatar
NOPepin a validé
class Taxe
{
    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column]
    private ?int $id = null;

    #[ORM\ManyToOne(inversedBy: 'taxes')]
    #[ORM\JoinColumn(nullable: false)]
    private ?Commune $commune = null;

    #[ORM\Column]
    private ?int $annee = null;

    #[ORM\ManyToOne(inversedBy: 'taxes')]
    #[ORM\JoinColumn(nullable: false)]
    private ?TypeTaxe $type = null;

    #[ORM\Column]
    private ?float $taux = null;

    #[ORM\Column]
    private ?float $volume = null;

    public function getId(): ?int
    {
        return $this->id;
    }

    public function getCommune(): ?Commune
    {
        return $this->commune;
    }

    public function setCommune(?Commune $commune): static
    {
        $this->commune = $commune;

        return $this;
    }

    public function getAnnee(): ?int
    {
        return $this->annee;
    }

    public function setAnnee(int $annee): static
    {
        $this->annee = $annee;

        return $this;
    }

    public function getType(): ?TypeTaxe
    {
        return $this->type;
    }

    public function setType(?TypeTaxe $type): static
    {
        $this->type = $type;

        return $this;
    }

    public function getTaux(): ?float
    {
        return $this->taux;
    }

    public function setTaux(float $taux): static
    {
        $this->taux = $taux;

        return $this;
    }

    public function getVolume(): ?float
    {
        return $this->volume;
    }

    public function setVolume(float $volume): static
    {
        $this->volume = $volume;

        return $this;
    }
}