Exception, when adding new parameter in listener constructor

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
mpaw
Registered User
Posts: 141
Joined: Mon Sep 16, 2019 1:09 pm

Exception, when adding new parameter in listener constructor

Post by mpaw »

Hi.

I've added 2 additional constructor parameters. But after extension installation, it gives me error

Code: Select all

Exception: The service "mpaw.jskatex.listener" has a dependency on a non-existent service "utils".
#0 /var/www/html/phpBB3/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php(60): Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass->processValue()
#1 /var/www/html/phpBB3/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php(28): Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass->processValue()
#2 /var/www/html/phpBB3/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php(67): Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass->processValue()
#3 /var/www/html/phpBB3/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php(28): Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass->processValue()
#4 /var/www/html/phpBB3/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php(60): Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass->processValue()
#5 /var/www/html/phpBB3/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php(28): Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass->processValue()
#6 /var/www/html/phpBB3/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php(39): Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass->processValue()
#7 /var/www/html/phpBB3/vendor/symfony/dependency-injection/Compiler/Compiler.php(140): Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass->process()
#8 /var/www/html/phpBB3/vendor/symfony/dependency-injection/ContainerBuilder.php(789): Symfony\Component\DependencyInjection\Compiler\Compiler->compile()
#9 /var/www/html/phpBB3/phpbb/di/container_builder.php(223): Symfony\Component\DependencyInjection\ContainerBuilder->compile()
#10 /var/www/html/phpBB3/common.php(115): phpbb\di\container_builder->get_container()
#11 /var/www/html/phpBB3/adm/index.php(23): require('/var/www/html/p...')
#12 {main}
What is the correct name of service?

heres my services.yml file

Code: Select all

services:
    mpaw.jskatex.listener:
        class: mpaw\jskatex\event\main_listener
        arguments:
            - '@language'
            - '@utils'
            - '@parser'
        tags:
            - { name: event.listener }

Code: Select all

/* @var \phpbb\language\language */
protected $language;

/* @var \phpbb\textformatter\s9e\utils */
protected $utils;

/* @var \phpbb\textformatter\s9e\parser */
protected $parser;

public function __construct(\phpbb\language\language $language, \phpbb\textformatter\s9e\utils $utils, \phpbb\textformatter\s9e\parser $parser)
{
	$this->language = $language;
	$this->utils    = $utils;
	$this->parser   = $parser;
}
How to fix it? phpBB turned off all of my extensions.
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: Exception, when adding new parameter in listener constructor

Post by 3Di »

mpaw wrote: Sat Sep 25, 2021 9:24 am heres my services.yml file

Code: Select all

services:
    mpaw.jskatex.listener:
        class: mpaw\jskatex\event\main_listener
        arguments:
            - '@language'
            - '@utils'
            - '@parser'
        tags:
            - { name: event.listener }

Code: Select all

services:
    mpaw.jskatex.listener:
        class: mpaw\jskatex\event\main_listener
        arguments:
            - '@language'
            - '@text_formatter.s9e.utils'
            - '@text_formatter.s9e.parser'
        tags:
            - { name: event.listener }
PURGE THE CACHE THEN.
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: Exception, when adding new parameter in listener constructor

Post by david63 »

Even easier if you use autowire
David
Remember: You only know what you know and - you don't know what you don't know!

I now no longer support any of my extensions but they will start to become available here
mpaw
Registered User
Posts: 141
Joined: Mon Sep 16, 2019 1:09 pm

Re: Exception, when adding new parameter in listener constructor

Post by mpaw »

Thank you so much! :)

PS. What's autowire?
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: Exception, when adding new parameter in listener constructor

Post by 3Di »

mpaw wrote: Sat Sep 25, 2021 9:39 am PS. What's autowire?
Forget, still you need to learn the basics ;)
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
mpaw
Registered User
Posts: 141
Joined: Mon Sep 16, 2019 1:09 pm

Re: Exception, when adding new parameter in listener constructor

Post by mpaw »

Ok, thanks.

Last question:
Where can I find full list of service, which should I to services.yml file, If i use them?

Thanks ;)
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: Exception, when adding new parameter in listener constructor

Post by 3Di »

mpaw wrote: Sat Sep 25, 2021 9:44 am Where can I find full list of service, which should I to services.yml file, If i use them?
In the PHPBB_ROOT\config\default\container folder
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
mpaw
Registered User
Posts: 141
Joined: Mon Sep 16, 2019 1:09 pm

Re: Exception, when adding new parameter in listener constructor

Post by mpaw »

Thank you so much.
Post Reply

Return to “Extension Writers Discussion”