<?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\GocardlessBundle\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 (in_array($event->getEntityName(), ['invoice', 'quotation'])) {
$event->addPath([
'url' => 'gocardless_bundle__public_document_infos',
'id' => $event->getEntityId()
]);
}
}
}