<?php
/**
* @author Thomas HERISSON (contact@scaledev.fr)
* @copyright 2021 - ScaleDEV SAS, 12 RUE CHARLES MORET, 10120 ST ANDRE LES VERGERS
* @license commercial
*/
declare(strict_types=1);
namespace Bluue\SalesBundle\EventSubscriber;
use App\Event\PublicDocumentPathsEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class EditPublicDocumentPathsSubscriber implements EventSubscriberInterface
{
/**
* @return string[]
*/
public static function getSubscribedEvents(): array
{
return [
PublicDocumentPathsEvent::NAME => 'onLoad'
];
}
/**
* @param PublicDocumentPathsEvent $event
* @return void
*/
public function onLoad(PublicDocumentPathsEvent $event): void
{
if ($event->getEntityName() == 'invoice') {
$event->addPath([
'url' => 'sales_bundle__public_document_infos',
'id' => $event->getEntityId()
]);
}
}
}