Jump to content

Instantiate an object declared in the module from a controller override


Recommended Posts

Hi,

I created a module in PrestaShop 8.1 where I declare class VirtualProductExternalLink extends \ObjectModel in /src/Entity/ folder.

I made an override GetFileController.php of the GetFileControllerCore controller placed in the override/controllers/front/ folder of the module (when installing the module this file is placed in the /override/controllers/front/ folder of PrestaShop)

In this override I want to instantiate a VirtualProductExternalLink object with $external_link = new VirtualProductExternalLink($id_product); but I have the error Uncaught Error: Class "VirtualProductExternalLink" not found.

At the beginning of the override file, I indicated:

use ProductVirtualExternalFile\Entity\VirtualProductExternalLink;
or include_once _PS_MODULE_DIR_.'productvirtualexternalfile/src/Entity/VirtualProductExternalLink.php';

but i have the same error.

How can I create a declare object in the module from my controller override?

Thanks for the information

Link to comment
Share on other sites

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...