How get object's method by string in twig -


in php can object method as:

$methodname="getid"; $obj->{$methodname}(); 

is there such features in twig?

upd: :

{% set method='getid' %} {{ obj[method]() }} 

now use extention:

{{ getter(obj, method) }} 

but maybe there standard solution?

a standard solution exist, similar extension:

{{ attribute(obj, method) }} 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Socket.connect doesn't throw exception in Android -

iphone - How do I keep MDScrollView from truncating my row headers and making my cells look bad? -