collection-crud/src/Entity/PurchasePriceTrait.php

28 lines
496 B
PHP

<?php declare(strict_types=1);
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
trait PurchasePriceTrait
{
#[ORM\Column(name: 'purchase_price', type: 'money', nullable: true)]
private ?string $purchasePrice = null;
public function setPurchasePrice(?string $purchasePrice): self
{
$this->purchasePrice = $purchasePrice;
return $this;
}
public function getPurchasePrice(): string
{
if (empty($this->purchasePrice)) {
return '0';
}
return $this->purchasePrice;
}
}