src/Entity/ItemDocumentIndicator.php line 32
<?phpdeclare(strict_types=1);namespace App\Entity;use ApiPlatform\Core\Annotation\ApiResource;use ApiPlatform\Core\Annotation\ApiSubresource;use App\Entity\Mapped\Entity;use App\Repository\ItemDocumentIndicatorRepository;use App\Validator\Constraint as CustomValidator;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Validator\Constraints as Assert;#[ORM\Entity(repositoryClass: ItemDocumentIndicatorRepository::class)]#[ORM\Table(name: 'item_document_indicator')]#[ApiResource(collectionOperations: [],itemOperations: ['get','patch' => ['validation_groups' => ['update']]])]class ItemDocumentIndicator extends Entity{#[ORM\Column(name: 'value',type: 'decimal',precision: 20,scale: 2,nullable: true)]#[Assert\NotBlank(groups: ['update'])]#[CustomValidator\PriceFormat(groups: ['update'],message: 'item.invalidFormat')]private ?string $value = '0';#[ORM\ManyToOne(targetEntity: ItemIndicator::class,cascade: ['persist'],inversedBy: 'documentIndicators')]#[ORM\JoinColumn(name: 'item_indicator')]#[Assert\NotBlank(groups: ['create', 'update'])]#[ApiSubresource]private ?ItemIndicator $itemIndicator = null;#[ORM\ManyToOne(targetEntity: ItemDocument::class,cascade: ['persist'],inversedBy: 'documentIndicators')]#[ORM\JoinColumn(name: 'item_document')]#[Assert\NotBlank(groups: ['create', 'update'])]#[ApiSubresource]private ?ItemDocument $itemDocument = null;public function getItemIndicator(): ?ItemIndicator{return $this->itemIndicator;}public function getValue(): ?string{if ($this->value&&str_contains($this->value, ',')) {return $this->value;}return $this->value ? number_format((float) $this->value, 2, ',', '.') : null;}public function setValue(?string $value): self{$this->value = $value;return $this;}public function setItemIndicator(?ItemIndicator $itemIndicator): self{$this->itemIndicator = $itemIndicator;return $this;}public function getItemDocument(): ?ItemDocument{return $this->itemDocument;}public function setItemDocument(?ItemDocument $itemDocument): self{$this->itemDocument = $itemDocument;return $this;}}