Strict Model: Dot-notation reference by search #211
Labels
No labels
bug
confirmed
critical
discussion
documentation
Doing
enhancement
experiment
suggestion
support
Testing
To Do
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: hazaar/framework#211
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Currently, we can use
Hazaar\Model\Strict::get($key)
with a$key
specified in dot-notation to dive down into child objects to get data. However, if the child object key is not known, we would normally useHazaar\Model\Strict::find((array)$criteria)
to search for it. At the moment we can't do that with dot-notation so we can only use dot-notation to reference things with known keys.What I would like to do, is extend the dot-notation syntax to allow for searching inside objects.
For example, I have a
product
type object which has an element namedproductNames
, which is a child array object that contains objects of typeProductName
. Traditionally, if we wanted to get the first product name, we could use dot-notation such asproduct.productNames.0.label
to get the label field from the product name. Now say these names are not ordered, and we don't want the first one, we actually want one which has an element namedproductNameType
which is a number indicating the type, and we want to find the one with type=3.I would like to be able to use this syntax:
product.productNames(productNameType=3).label
to get the correct field.This should be a relativly simple update as all the functionality is there, we just need to decode the dot-notation syntax and call
find()
internally when needed.created merge request !106 to address this issue
mentioned in merge request !106
mentioned in commit f97fa64203ca46fc5ac6b8f04010fec24d14dcce