<?php
namespace App\EventListener;
use App\Model\DataObject\Address;
use Pimcore\Event\Model\ElementEventInterface;
use Pimcore\Event\Model\DataObjectEvent;
//use Pimcore\Model\DataObject\Books;
use Pimcore\Model\DataObject;
use App\Twig\Extension\Apik;
class ObjectListener
{
public function onPreUpdate(ElementEventInterface $e)
{
if ($e instanceof DataObjectEvent) {
$obj = $e->getObject();
/*
if($obj instanceof DataObject\News){
$languages = \Pimcore\Tool::getValidLanguages();
foreach($languages as $lang) {
$obj->setSlug(Apik::toUrl($obj->getTitle($lang)), $lang);
}
} elseif($obj instanceof DataObject\Tags){
$languages = \Pimcore\Tool::getValidLanguages();
foreach($languages as $lang) {
$obj->setSlug(Apik::toUrl($obj->getTitle($lang)), $lang);
}
}*/
}
}
}