first commit
This commit is contained in:
45
bundles/KupShop/SalesBundle/Entity/SaleItem.php
Normal file
45
bundles/KupShop/SalesBundle/Entity/SaleItem.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace KupShop\SalesBundle\Entity;
|
||||
|
||||
use KupShop\KupShopBundle\Util\Price\Price;
|
||||
|
||||
class SaleItem
|
||||
{
|
||||
public int $id;
|
||||
|
||||
public ?int $productId = null;
|
||||
|
||||
public ?int $variationId = null;
|
||||
|
||||
public float $pieces;
|
||||
|
||||
public Price $piecePrice;
|
||||
|
||||
public Price $totalPrice;
|
||||
|
||||
public string $name;
|
||||
|
||||
public array $data;
|
||||
|
||||
private ?\Product $product = null;
|
||||
|
||||
public function setProduct(?\Product $product): self
|
||||
{
|
||||
$this->product = $product;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getProduct(): ?\Product
|
||||
{
|
||||
if (!$this->product && $this->productId) {
|
||||
$this->product = \Variation::createProductOrVariation($this->productId, $this->variationId);
|
||||
$this->product->createFromDB();
|
||||
}
|
||||
|
||||
return $this->product;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user