<?php
namespace App\Model\DataObject;
use Pimcore\Model\DataObject\ClassDefinition;
use Pimcore\Model\DataObject\Solution;
use Pimcore\Model\DataObject\Review;
use App\Services\ObjectServices;
use App\Helper\ObjectJson;
abstract class AbstractSearch extends \Pimcore\Bundle\EcommerceFrameworkBundle\Model\AbstractProduct
{
const DELMIMITER = '**';
public function getOSName(): ?string
{
return $this->getName();
}
public function getOSProductNumber(): ?string
{
return $this->getId();
}
public function isActive(bool $inProductList = false) :bool
{
return $this->isPublished();
}
/**
* @return |null
*/
public function getPrice()
{
$saleInformationBrick = $this->getSaleInformation();
$saleInformation = $saleInformationBrick->getSaleInformation();
if ($saleInformation) {
return $saleInformation->getPriceInEUR();
}
return null;
}
public function getPriceSystemName() :?string
{
return 'default';
}
public function getTrialDays() : float
{
if($this instanceof Solution){
return $this->getFreeTrial() ? $this->getFreeTrialDays() : 0;
}
return 0;
}
public function getJson($hiddenFields = ['solution'])
{
$jsonDetail = ObjectJson::getJson($this, $hiddenFields);
return $jsonDetail;
}
public function getText()
{
if ($this instanceof Solution) {
$text = self::DELMIMITER . $this->getName() . self::DELMIMITER. $this->getDescription() . self::DELMIMITER ;
return $text;
}
if ($this instanceof Review) {
$text = self::DELMIMITER . $this->getTitle(). self::DELMIMITER;
return $text;
}
return null;
}
public function getCompanySizeReview()
{
if ($this instanceof Review) {
return $this->getCompanySize();
}
return null;
}
public function getGeneralScoreReview()
{
if ($this instanceof Review) {
return $this->getGeneralScore();
}
return null;
}
}