This project is not covered by Drupal’s security advisory policy.

This is a simple drush plugin that adds the ability to perform a basic EntityFieldQuery (EFQ). This is useful when querying for counts or getting fully built entity data out of drupal as part of command-line scripts like bash. This allows you to pipe values out of drupal via drush, some basic examples are included below:

Examples:
drush efq node page -- load all page nodes and print them to the screen
drush efq node article --format=json -- print all article nodes as json
drush efq user user --format=json -- print all users as json
drush efq user user --count -- return a count of how many users are in the current site
drush efq user user '[]' student --count -- return how many users have role student (special case in querying for users by role)

You can also pass in more advanced EFQ arguments as a 3rd optional argument but this needs to be in json format. Here are some examples from ELMSLN


# all the students in all the courses
d @courses-all efq user user '[]' student --count --y

# all of the courses that are being publicly marketed
d @online efq node course '[{"condition":"fieldCondition","arguments":["field_display_in_course_list","value","1","="]}]' --count

# number of service_instances that are for the "course" service
d @online efq node service_instance '[{"condition":"propertyCondition","arguments":[ "title","%courses","LIKE"]}]' --count --format=json

This would apply the additional conditions and pass the appropriate arguments to it.

Supporting organizations: 
Developed, Implemented

Project information

Releases