collection-crud/src/Entity/PurchasePriceTrait.php

28 lines
496 B
PHP
Raw Normal View History

2018-07-18 11:35:27 -04:00
<?php declare(strict_types=1);
2017-11-30 15:06:13 -05:00
namespace App\Entity;
2017-11-30 15:06:13 -05:00
2022-02-18 11:34:25 -05:00
use Doctrine\ORM\Mapping as ORM;
2017-11-30 15:06:13 -05:00
trait PurchasePriceTrait
{
2022-02-18 11:34:25 -05:00
#[ORM\Column(name: 'purchase_price', type: 'money', nullable: true)]
private ?string $purchasePrice = null;
public function setPurchasePrice(?string $purchasePrice): self
2017-11-30 15:06:13 -05:00
{
$this->purchasePrice = $purchasePrice;
return $this;
}
2022-02-18 11:34:25 -05:00
public function getPurchasePrice(): string
2017-11-30 15:06:13 -05:00
{
if (empty($this->purchasePrice)) {
2022-02-18 11:34:25 -05:00
return '0';
2017-11-30 15:06:13 -05:00
}
return $this->purchasePrice;
}
}