<?php
namespace App\EventListener;
use Pimcore\Event\Model\ElementEventInterface;
use Pimcore\Event\Model\DataObjectEvent;
use Pimcore\Model\DataObject\Review;
use Pimcore\Model\DataObject\Solution;
use Pimcore\Model\DataObject\News;
use Pimcore\Model\DataObject;
use Pimcore\Model\DataObject\Search;
use Pimcore\Model\DataObject\ClassDefinition;
use App\Services\SearchService;
use \Pimcore\Config;
class SearchEventListener
{
const CLASS_ID = 'search';
protected $searchService;
public function __construct(SearchService $searchService)
{
$this->searchService = $searchService;
}
protected function getLabel($field)
{
$classData = ClassDefinition::getById(self::CLASS_ID);
return $classData->getFieldDefinitions()[$field]->getTitle();
}
public function preUpdate(DataObjectEvent $e)
{
$object = $e->getObject();
if ($object instanceof Review || $object instanceof Solution || $object instanceof News) {
// $this->searchService->format($object);
}
}
}