PrestaShop / PrestaShop/docs

Using Symfony Request service in Prestashop module

Open
#612 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
136
Forks
555
Avg merge
4d 14h
Merged PRs (30d)
4

Description

I'm currently developing a custom module for Prestashop and because Prestashop 1.7 is now based on Symfony I am investing some extra time in using the Symfony platform as much as possible rather than using plain old php or Prestashop libraries.

Prestashop now provides a way to obtain a container to Symfony services which can be used anywhere in a module. I am attempting to use this access the Symfony\Component\HttpFoundation\Request services but without luck. Below is what I have tried so far:

$this->container->get('symfony.component.httpfoundation.request');

and

$this->container->get('request');

and also:

$this->container->get('request_stack')->getCurrentRequest();

all of which result in the error:

You have requested a non-existent service

Is it possible to use Request service via the container?

Kind Regards
Musaffar

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is identified in the issue. Start by reviewing the existing PrestaShop module-container documentation and the Symfony Request and request_stack service usage described here; done means documenting the supported way to access the current request, or clearly stating that this is not supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, symfony
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.