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

Provide a ParamConverter than can upcast any entity.

$
0
0

This issue is a follow-up for #1798214: Upcast request arguments/attributes to full objects.

The aforementioned issue provides a nice solution for upcasting single, isolated parameters in a route. In some cases, this is not sufficient, though. For example, in a route that consists of two parameters '/{entity_type}/{entity}' (=> e.g '/node/1', '/user/1') we need to know the value of {entity_type} in order to properly upcast into an EntityInterface object. The patch provided in #1798214: Upcast request arguments/attributes to full objects does not account for that (yet). A possible solution would be to provide the relevant information for how to upcast {entity} through route options, e.g. provide the name of the {slug} that is the {entity_type} and then use that in a AnyEntityParamConverter. I am not sure if that is a proper approach for solving this but I believe that we should support upcasting for 'dynamic' params like this.


Viewing all articles
Browse latest Browse all 295245

Trending Articles



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