esmero / strawberryfield

A Field of strawberries
GNU Lesser General Public License v3.0
10 stars 5 forks source link

wrapControllerExecutionInRenderContext (Early Rendering issue/work around for JSON API) needs a retouch #291

Closed DiegoPino closed 8 months ago

DiegoPino commented 8 months ago

What?

On D10 we had to port the Early Rendering Module to our own bc it was unmaintained. Today while testing the new code for Metadata Display Entities i discovered that Symfony5 passes both Arrays AND also Objects (precompiled?) $controllers. Bc people don't use strict arguments (means this function allows to be called with anything...) our code fails on the revision route (only!)

The solution is to do here:

https://github.com/esmero/strawberryfield/blob/6e3824cc9ad547692eb134a0764d6ebc4c35b896/src/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php#L25

This instead

protected function wrapControllerExecutionInRenderContext($controller, array $arguments) {

    $class = is_array($controller) ? get_class($controller[0]) : get_class($controller);
    if ($class === "Drupal\jsonapi\Controller\EntityResource"){

What a mess (not my fault)

DiegoPino commented 8 months ago

Resolved