Problem/Motivation

Recent changes to PatternkitController introduced type error:

TypeError: Drupal\patternkit\Controller\PatternkitController::__construct(): Argument #5 ($request) must be of type Symfony\Component\HttpFoundation\Request, Drupal\Core\Http\RequestStack given, called in /var/www/docroot/modules/contrib/patternkit/src/Controller/PatternkitController.php on line 105 in Drupal\patternkit\Controller\PatternkitController->__construct() (line 71 of modules/contrib/patternkit/src/Controller/PatternkitController.php).

Steps to reproduce

* Using PHP 8.1.8
* Install latest 9.1.x dev version, commit
* go to /patternkit_block/add
* Observer error

Proposed resolution

Fix type hinting to match the request_stack service

Issue fork patternkit-3315429

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jasonawant created an issue. See original summary.

jasonawant’s picture

Assigned: jasonawant » Unassigned
Status: Active » Needs review
jasonawant’s picture

Assigned: Unassigned » jasonawant
Status: Needs review » Needs work

This needs work.

The usage of $query = $this->requestStack->query->all(); does not work with requestStack.

jasonawant’s picture

Assigned: jasonawant » Unassigned

Looks like we need grab the current request from the request_stack in the constructor.

I'll update the MR this afternoon, but I'll mark this as unassigned for now.

jasonawant’s picture

Status: Needs work » Needs review

got to this sooner than I thought I would

slucero’s picture

Status: Needs review » Closed (duplicate)
Parent issue: » #3308212: Beta 6 Release Plan
Related issues: +#3314209: Deprecated Service: Remove Usage of Patternkit Library Service

In #3314209: Deprecated Service: Remove Usage of Patternkit Library Service I had to refactor a bit of this controller class and got testing added for it. As part of that work, I've incorporated the fix proposed here and we'll get it merged in there. The fix is very similar, and I'll update that issue momentarily to add the credit for the work on it.

Thanks!