Skip to content

[PropertyAccessor] Support of [] syntax to iterate in an array #45084

Closed
@maidmaid

Description

@maidmaid

Description

The next example below is not supported... It throws :

Could not parse property path "[][key]". Unexpected token "[" at position 0.

Example

$array = [
    ['key' => 1],
    ['key' => 2],
];

$propertyAccessor->getValue($array, '[][key]'); // should return [1, 2]

It would be similar to the next jq run :

$ echo '[{"key": 1},{"key": 2}]' | jq ".[].key"                                                                                                                          0|5 err 
1
2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions