-
-
Notifications
You must be signed in to change notification settings - Fork 97
Open
Description
Hello,
I am trying to filter an array of objects with the Native target. The objects that I am trying to filter contain an array of objects. When I try to filter the array, I get a property access exception:
Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException(code: 0): Cannot read property "name" from an array. Maybe you intended to write the property path as "[name]" instead.
Here is a simplified snippet of my objects:
class Label
{
public $name = 'something';
}
class User
{
public $labels;
public function __construct()
{
$this->labels = [
new Label(),
new Label(),
new Label()
];
}
}
Here is a snippet of my RulerZ specification:
class UserLabelsNameSpecification implements Specification
{
public function getRule()
{
return 'labels.name = "something"';
}
}
Here is the filter:
$users = [
new User(),
new User(),
new User()
];
$filtered_users = $rulerz->filterSpec($users, new UserLabelsNameSpecification());
Is RulerZ supposed to support this? Perhaps I'm doing something wrong? I could not find an example of this situation. My example works fine with the DoctrineOrm target.
hco
Metadata
Metadata
Assignees
Labels
No labels