New feature: DataObject::getBy system properties

What was the issue? 

There are system variables that weren’t supported by any getBy method. That means that if anyone wanted to get for example a child of some object, he should create a new listing, add the condition for the parent and then get the objects from the listing. 

How did you solve it? 

Pimcore already had getByProperty for every property on an object and for some system predefined properties. Because I didn’t want to change any Pimcore functionality, the code is added after the old Pimcore code. Now instead of throwing an exception, first is checked if getBySystemProperty is actually a system property and if it is it does the same logic as with any other object property. 

Why is this fix important?

For example, let's say that a programmer wants to get all objects that are children of some other objects. He could create a new listing and set the condition and then get it from there, or he could create some service that needs to get injected into his class so he can reuse his getByParentId method. Now all he needs to do is call $object->getByParentId($parentId) to get all children of that object.

How does it feel to contribute to a platform such as Pimcore? 

For now, most likely I will stick to providing pull requests for bug fixes or some minor improvements. Besides that, probably some articles about some of the Pimcore functionality that I see are interesting and useful. I wasn’t thinking about courses but now that you ask, yea maybe even some courses for beginners that want to start with Pimcore and don’t know how or where.

And if you want to check out this pull request, just follow the link! 

Looking for Exponential Growth? Let’s Get Started.
Explore next

Pimcore guides & How to

Collection of latest concepts, viewpoints and examples from the Pimcore word written by Pimcore industry experts.

Discover more