collection-crud/src/Entity/PurchasePriceTrait.php

28 lines
559 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-03-03 11:15:12 -05:00
#[ORM\Column(name: 'purchase_price', type: 'money', nullable: TRUE)]
private ?string $purchasePrice = NULL;
2022-02-18 11:34:25 -05:00
2022-03-03 10:53:48 -05:00
public function setPurchasePrice(?string $purchasePrice): self
{
$this->purchasePrice = $purchasePrice;
2017-11-30 15:06:13 -05:00
2022-03-03 10:53:48 -05:00
return $this;
}
2017-11-30 15:06:13 -05:00
2022-03-03 10:53:48 -05:00
public function getPurchasePrice(): string
{
if (empty($this->purchasePrice)) {
return '0';
}
2017-11-30 15:06:13 -05:00
2022-03-03 10:53:48 -05:00
return $this->purchasePrice;
}
2017-11-30 15:06:13 -05:00
}