|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
-
- namespace Lc\CaracoleBundle\Model\Order;
-
- use Doctrine\ORM\Mapping as ORM;
- use Lc\CaracoleBundle\Doctrine\Extension\ReductionTrait;
-
- /**
- * @ORM\MappedSuperclass()
- */
- abstract class OrderProductReductionCatalogModel
- {
- use ReductionTrait;
-
- /**
- * @ORM\Column(type="string", length=255)
- */
- protected $title;
-
- public function getTitle(): ?string
- {
- return $this->title;
- }
-
- public function setTitle(string $title): self
- {
- $this->title = $title;
-
- return $this;
- }
-
- // getSummaryOrderProductReductionCatalog
- public function getSummary()
- {
- $text = '';
-
- if ($this->getUnit() == 'amount') {
- $text .= '- ' . $this->getValue() . ' €';
- }
-
- if ($this->getUnit() == 'percent') {
- $text .= '- ' . $this->getValue() . ' %';
- }
-
- return $text;
- }
-
- // compareOrderProductReductionCatalog
- public function compare($orderProductReductionCatalog)
- {
- return $orderProductReductionCatalog
- && $this->getUnit() == $orderProductReductionCatalog->getUnit()
- && (string)$this->getValue() == (string)$orderProductReductionCatalog->getValue()
- && $this->getBehaviorTaxRate() == $orderProductReductionCatalog->getBehaviorTaxRate();
- }
- }
|