HasCompteEntity.php 1.12 KB
<?php

namespace App\Entity\EntityTrait;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Serializer\Annotation\Groups;

trait HasCompteEntity
{
    /**
     * Compte de billets
     * @var int
     *
     * @ORM\Column(name="compte", type="decimal", precision=12, scale=2)
     * @Groups({"read"})
     */
    private $compte = 0;

    /**
     * @return int
     */
    public function getCompte(): float
    {
        return $this->compte;
    }

    /**
     * @param int $compte
     * @return $this
     */
    public function setCompte(float $compte)
    {
        $this->compte = $compte;
        return $this;
    }

    /**
     * Incremente le compte
     * @param int $compte
     * @return $this
     */
    public function addCompte(float $compte)
    {
        $this->compte += $compte;
        return $this;
    }

    /**
     * Décremente le compte
     * @param int $compte
     * @return $this
     */
    public function removeCompte(float $compte)
    {
        $this->compte -= $compte;
        return $this;
    }
}