Ali Samie Posted July 5, 2022 Share Posted July 5, 2022 Is there a way to load symfony services inside module front controller? Like this: $importer = $this->get('prestashop.core.import.importer'); When I use this line inside a module front controller I get to this line: throw new ServiceNotFoundException($id, null, null, $alternatives); which means that this service does not exist in this container. So we come to this point that these services are only added to admin controllers. So can we create a controller called "FrameworkBundleFrontController" just like "FrameworkBundleAdminController"? Link to comment Share on other sites More sharing options...
Prestachamps Posted July 5, 2022 Share Posted July 5, 2022 Hi, As I know this at the moment it can only be used in the backoffice / Admin part. Have a nice day, Kind regards, Leo 1 Link to comment Share on other sites More sharing options...
Ali Samie Posted July 5, 2022 Author Share Posted July 5, 2022 @Prestachamps thanks for the fast reply. Please take a look at this: I have tested and I it kind of works. But the issue is that the importer class requires the employee access and it does not work. It seems like that the implementation of import is coupled with admin access for employee. So it is not possible to reuse the symfony services of admin in front end controllers. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now