Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291119

What to do with raw request attributes vs. converted (upcast) attributes

$
0
0

This issue #2031487: Don't replace the upcasted values in the request attributes array. solves the problem that we are currently completely overriding the raw request attributes which makes it rather hard to generate urls related to the current request as we do not have a way to "downcast" things back to their original values... However, there is room for discussion whether it makes more sense to instead store a copy of the raw values in the request:

<?php
$attributes
= $request->attributes->all();
$variables = array_flip($route->getVariables());
$request->attributes->set('raw', array_intersect_key($attributes, $variables));
?>

One could argue that it is probably better to indeed override as that does not require us to override doGetArguments() in the ControllerResolver... Note: This is a problem specific to our implementation as Symfony seems to handle this slightly different apparently (they do not override, but instead turn {post_id} into $post for example).


Viewing all articles
Browse latest Browse all 291119

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>