<?php
namespace App\Entity\PointsCatalog;
use App\Annotation\SiteAware;
use App\Entity\AbstractBase;
use App\Entity\Interfaces\SiteInterface;
use App\Entity\MiniAbstractBase;
use App\Entity\Traits\DescriptionTrait;
use App\Entity\Traits\NameTrait;
use App\Entity\Traits\PublishedTrait;
use App\Entity\Traits\SiteTrait;
use App\Repository\PointsCatalog\CatalogConversionFormulaRepository;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Table(name="vulco_points_catalog_conversion_formula", indexes={@ORM\Index(name="catalog_conversion_formula_site_idx", columns={"site"})})
* @ORM\Entity(repositoryClass=CatalogConversionFormulaRepository::class)
* @Gedmo\SoftDeleteable(fieldName="removedAt", timeAware=false)
* @SiteAware(siteFieldName="site")
*/
class CatalogConversionFormula extends AbstractBase implements SiteInterface
{
use DescriptionTrait;
use NameTrait;
use PublishedTrait;
use SiteTrait;
/**
* @ORM\Column(type="string", length=255, nullable=false)
* @Assert\NotBlank()
*/
private string $name;
/**
* @ORM\Column(type="text", length=10000, nullable=true)
*/
private ?string $description = null;
/**
* @ORM\Column(type="float", nullable=false)
* @Assert\NotBlank()
*/
private float $ratio;
public function getRatio(): float
{
return $this->ratio;
}
public function setRatio(float $ratio): self
{
$this->ratio = $ratio;
return $this;
}
public function __toString(): string
{
return $this->name ? $this->getName() : MiniAbstractBase::DEFAULT_EMPTY_STRING;
}
}