I am trying to build an extension for upgrade-safe as not to edit core file BasePDFManager.php
I am trying to change the PDF file name.
I can edit the BasePDFManager file and it works.
I can’t get it to work with the extension.
Here is my extension.php for registering the extension-
use Symfony\Component\DependencyInjection\Container;
if (!isset($container)) {
return;
}
/** @var Container $container */
$extensions = $container->getParameter(‘extensions’) ?? ;
$extensions[‘NewPdfName’] = [
‘remoteEntry’ => ‘../extensions/NewPdfName/remoteEntry.js’,
‘remoteName’ => ‘NewPdfName’,
‘enabled’ => true,
Here is my namespace file (PdfHandler.php)-
namespace App\Extension\NewPdfName\backend;
use App\backend\Proces\LegacyHandler\Pdf\BasePDFManager;
use App\Engine\LegacyHandler\LegacyHandler;
use App\Process\Service\ProcessHandlerInterface;
use App\Data\Service\Record\RecordSaveHandlers\RecordSaveHandlerInterface;
class PdfHandler extends BasePDFManager implements LegacyHandler
{
// Your business logic here
public function run($fileName, $moduleBean)
{
$fileName = $this->getPdfName($moduleBean->name, $moduleBean->project_c);
$fileName = str_replace('_', '-', $fileName);
}
}
My extension get registered but does not execute when I print-as-PDF on an invoice.
Can you tell me what I an not doing or doing wrong?
I am not use to working with the new Symfony structure.