PrestaShop / PrestaShop/docs

Symfony Container not available for Legacy Environment

Open
#301 8 comments 0 reactions 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

The PrestaShop Module Services documentation mentions that we are able to obtain the Symfony Container from our modules. This isn't working for me when extending PaymentModule on 1.7.5.2.

public function getContent()
{
    // Error: Attempted to call an undefined method named "getContainer" of class "AdminModulesController".
    $formFactory = $this->context->controller->getContainer()->get('form.factory');
}

I did find something similar in the Psaddonsconnect which does work for me. Should we use this instead?

public function getContent()
{
    global $kernel;
    $formFactory = $kernel->getContainer()->get('form.factory');
}

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

Start with the linked Services documentation and compare its container-access example with the legacy PaymentModule/AdminModulesController context described here. Verify which approach is supported for PrestaShop 1.7.5.2, then update the documentation to state the correct version-specific usage and any relevant limitations.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, symfony
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.