Drush Entity
Component ID
Component name
Component type
Maintenance status
Development status
Component security advisory coverage
Downloads
Component created
Component changed
Component body
With drush entity you can query the entity system available for Drupal 8, 7 and (some of) 6.
Getting started
Install by using drush dl drush_entity. Next you can try commands like
drush entity-type-read
drush entity-type-read node
drush entity-read node 12
The following commands should work against Drupal 6, Drupal 7 and Drupal 8. Please report bugs when this is not the case.
drush entity-update node 3
drush entity-read node 3 | less
#read in json format
drush entity-read node 3 --format=json
drush entity-type-read user
drush entity-type-read node --fields=label
drush entity-type-read user node --fields=label,bundles/*/label,drush/count
List all users with their name and mail
drush @drupal.d7 entity-read user `drush @drupal.d7 entity-read user` --fields=name,mail
Edit node title manually
drush @drupal.d7 entity-update node 53 --fields=title
drush @drupal.d7 entity-read node 53 --fields=title
Edit node title through STDIN
echo '{"title":"XXX"}' | drush --pipe @drupal.d7 entity-update node 53 --fields=title --json-input=-
drush @drupal.d7 entity-read node 53 --fields=title
You may use a file instead of STDIN
Demo video
You can also watch a video on http://www.youtube.com/watch?v=cVGZzWjdDh8 demonstrating some features (It takes you 1 minute.)
A list of commands used in this video can be found on http://build2be.com/content/drush-entity-support-patch-needs-review
Remaining tasks
#1005480: Create a new project to develop Drush entity support suggests a devel_generate approach but whilst working on the patch the create workflow tends to be a template driven one. That is
- Query ie an exisiting node
drush --json entity-read node 1 - Remove values from the json which are to be replaced by new values
- Next edit the json with new values
- Run
drush entity-create node /path/to/file/new-node.json
