Come together with the global Drupal community in Rotterdam, 28 Sept – 1 Oct 2026. Sessions, contribution, connection, and Early Bird savings until 8 June.
Committed build of the query wrapper system supporting querying by entity type. Enable the new Wrappers Delight Query submodule to use it. I still need to add the code to generate bundle-specific query wrappers. The entity query wrappers can be used like this:
It supports order and range modifiers. I still need to add property and field specific orderby methods, but you can call the generic ones at this point:
Query system is built. When the Wrappers Delight Query module is enabled, the drush wrap command will generate both an entity wrapper and a query wrapper class for each bundle. The query wrappers work as described above, with the addition that they now support orderBy() methods. So, something like this should work:
The drush command will also generate custom orderByXXXXX() methods for every field in your entity bundle. It works with field types that have a "value" column, file types ("fid"), and entityreferences ("target_id"). Everything else will likely need some hand tuning.
Comments
Comment #2
zengenuity commentedCommitted build of the query wrapper system supporting querying by entity type. Enable the new Wrappers Delight Query submodule to use it. I still need to add the code to generate bundle-specific query wrappers. The entity query wrappers can be used like this:
The query wrapper supports chaining and overriding the operator, so you can also do something like this:
It supports order and range modifiers. I still need to add property and field specific orderby methods, but you can call the generic ones at this point:
It supports fields and their value columns using dot syntax:
Comment #4
zengenuity commentedWrappers Delight Query module now supports bundle-specific queries with fields. So, you can now do something like:
Results will be of type ArticleNodeWrapper in this case. So, something like this should work:
Still need some code cleanup and tests.
Comment #6
zengenuity commentedQuery system is built. When the Wrappers Delight Query module is enabled, the drush wrap command will generate both an entity wrapper and a query wrapper class for each bundle. The query wrappers work as described above, with the addition that they now support orderBy() methods. So, something like this should work:
It supports fields and their value columns using dot syntax:
The drush command will also generate custom orderByXXXXX() methods for every field in your entity bundle. It works with field types that have a "value" column, file types ("fid"), and entityreferences ("target_id"). Everything else will likely need some hand tuning.
Comment #8
fox_01 commentedis it possible to add a query tag like?
Comment #9
zengenuity commentedI've added an
addTag()method to theWdWrapperQueryclass that will pass a tag down to the query inside.