Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Volt: access to object property which is in array #1577

Closed
iforp opened this issue Nov 21, 2013 · 6 comments
Closed

[BUG] Volt: access to object property which is in array #1577

iforp opened this issue Nov 21, 2013 · 6 comments
Labels
bug A bug report status: medium Medium

Comments

@iforp
Copy link
Contributor

iforp commented Nov 21, 2013

We have an array of objects

$arr = [
    (object)['key' => 'value'],
    (object)['key' => 'value'],
];

The following construction doesn't works in volt:
{{ arr[0].key }}

It generates PHP code

echo ($arr[0])->key;

Parse error: syntax error, unexpected '->'

* UPD issue description

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@waplet
Copy link

waplet commented Aug 27, 2014

Any fixes for this?

@JoHnYLucas
Copy link

It has been almost a year now, is it fixed?

@mjankovskis
Copy link

Is it fixed?

@dompie
Copy link

dompie commented Dec 6, 2014

I don't know if this is fixed, but you can workaround this with following code:

{% set myObject = arr[0] %}

{{ myObject.key }}
{{ myObject.function() }}

Doesn't hurt much.

@skollro
Copy link
Contributor

skollro commented Feb 21, 2015

@andresgutierrez
Copy link
Sponsor Contributor

Fixed in Phalcon 2.0.4

@niden niden added bug A bug report status: medium Medium and removed Bug - Medium labels Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report status: medium Medium
Projects
None yet
Development

No branches or pull requests

8 participants