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
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
Comment #3
jasonawantSee changes and MR here > https://git.drupalcode.org/project/patternkit/-/merge_requests/52
Comment #4
jasonawantThis needs work.
The usage of
$query = $this->requestStack->query->all();does not work with requestStack.Comment #5
jasonawantLooks 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.
Comment #8
jasonawantgot to this sooner than I thought I would
Comment #11
sluceroIn #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!