Jump to content

An exception has been thrown during the rendering of 1.7.7.0 a template ("You have requested a non-existent service "form.factory"."). Prestashop


Nishith Nesdiya

Recommended Posts

Hi..

I am using hookDisplayAdminProductsExtra hook with create sympony form in my custom module. 
 

public function hookDisplayAdminProductsExtra($params) 
{
	$formFactory = $this->get('form.factory');
	//More code
}

 Above code is working fine for prestashop 1.7.6.9 but when i have upgrade prestashop 1.7.7.0 then its give me this type of error 

An exception has been thrown during the rendering of a template ("You have requested a non-existent service "form.factory".").

can any help me for solve this problem in prestashop prestashop 1.7.7.0 ?

Thank you for your support 
 

Link to comment
Share on other sites

  • 3 months later...
On 1/1/2021 at 4:02 PM, Nishith said:

Hi..

I am using hookDisplayAdminProductsExtra hook with create sympony form in my custom module. 
 


public function hookDisplayAdminProductsExtra($params) 
{
	$formFactory = $this->get('form.factory');
	//More code
}

 Above code is working fine for prestashop 1.7.6.9 but when i have upgrade prestashop 1.7.7.0 then its give me this type of error 

An exception has been thrown during the rendering of a template ("You have requested a non-existent service "form.factory".").

can any help me for solve this problem in prestashop prestashop 1.7.7.0 ?

Thank you for your support 
 

Hi.

Replace

$this->get

with

PrestaShop\PrestaShop\Adapter\SymfonyContainer::getInstance()->get

Your method have to look like this

public function hookDisplayAdminProductsExtra($params) 
{
	$formFactory = PrestaShop\PrestaShop\Adapter\SymfonyContainer::getInstance()->get('form.factory');
	//More code
}

 

Link to comment
Share on other sites

  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...