We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Get property of an object, stored in array

What is the right way to get property of an object, that is stored in array? I've tried that syntax:

{{ array['object'].property }}

but it's generating wrong php:

<?php echo ($array['object'])->property; ?>


I can't understand why PHP can't execute <?php echo ($array['object'])->property; ?>

It seems you have to assign the array to a variable and get the property then:

{% set y = array['object']; %}
{{ y.x }}


@phalcon yeah, I used that trick, but just thought that there's some more 'native' way of achieving that