<?php
namespace App\EventListener;
use App\mvk\Debugger\ApplicationLogger;
use Pimcore\Event\Model\DataObjectEvent;
class DebugListener
{
protected ApplicationLogger $applicationLogger;
public function __construct(applicationLogger $applicationLogger)
{
$this->applicationLogger = $applicationLogger;
}
public function onPostUpdate(DataObjectEvent $event)
{
$object = $event->getObject();
if (method_exists($object,'getPublished')) {
if ($object && !$object->getPublished()) {
$this->applicationLogger->saveLog('debug', 'Object with Class: "'.$object->getClass()->getName().'" and ID:"'.$object->getId().'" Stacktrace: "'.json_encode(debug_backtrace()).'"', '700');
}
}
}
}