Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Taken from comments #38 - #45 of #1005480: Create a new project to develop Drush entity support
Comments
Comment #1
clemens.tolboomThere is afaik no need for a module / info file. Correct me if I'm wrong.
drush dl drush_entity
should place the code into .drush/drush_entity right?Comment #2
damiankloip CreditAttribution: damiankloip commentedYep, I think if it can be downloaded straight to the .drush dir that makes sense. It is a drush extension and not a module after all! Sounds like a sensible plan to me.
Comment #3
damiankloip CreditAttribution: damiankloip commentedNo module etc... or anything. I have pushed these changes to a new 7.x-5.x-el branch that provides the entity-list command. I have also added a couple of line of meta info to hook_drush_help so we get 'Entity commands' instead of 'All commands in entity'.
Comment #4
clemens.tolboomI added the command to the test script. It fails on using format.
Not sure what to do with it now. So I leave the --format out to just make it work for the test script.
I merged 7.x-5.x into 7.x-5.x-el
The data collected with
drush el
can almost be reproduces withdrush etr `drush etr` --fields="bundles/*/label,label,base table,revision table,fieldable,entity class,controller class"
apart from the entity count. We could add the count stats to _drush_entity_info() result thus make the table output 'just' a format. That opens the possibility to use --fields=_drush/count and we can then add a --colomns for simple tables.
What do you think?
Comment #5
clemens.tolboomI added the count to _drush_entity_info.
provides for all data for drush entity-list.
I think this is a nice addition to make a more general table output. Ie
should be possible later on.
We can now remove _drush_entity_count_table() right?
Comment #6
damiankloip CreditAttribution: damiankloip commentedI definitely agree a more general table output would be good as this is usually one of the easiest ways to view data.
So are we planning to just remove entity-list? I don't mind either way, I just think that I would get slightly annoyed if I wanted an entity overview I needed to run something like:
drush etr `drush etr` --fields="bundles/*/label,label,base table,revision table,fieldable,entity class,controller class,drush/count"
That might get a little tedious? When I could just have a command like "drush el" to provide this summary. I guess what I mean is we should have options to customise the output but I like this idea of the entity-list quick and easy summary of info.
Maybe we could have a "drush etr --summary" command instead?
Comment #7
damiankloip CreditAttribution: damiankloip commentedJust looked at the new changes, having the count in _drush_entity_get_info makes alot of sense. I like it :)
The only thing is that _drush_entity_get_info doesn't do a count currently for the info if the drupal major version is below 7 like in _drush_entity_count_table(). We should probably add this in too so we can mirror (kind of!) the functionality we can do with entities?
Comment #8
damiankloip CreditAttribution: damiankloip commentedI have just added this to _drush_entity_get_info on the 7.x-5.x-el branch. So $entity_info[$key]['drush']['count'] works for versions below 7.
Edit: Oh, and just removed _drush_entity_count_table function now all functionality is in _drush_entity_get_info :)
Comment #9
clemens.tolboomCool.
What I was trying to say using --fields is we could use
for arbitrary columns to print ie a node in a table format.
The current
status ofdifference between entity-list versus entity-type-read is now only in the formatters.I have create #1428568: Add use of table format for more then just entity-list for this.
I merged to 7.x-5.x ... thanks!!!
Comment #10
damiankloip CreditAttribution: damiankloip commentedAh, sorry. I get what you mean now :) that seems like a good idea.
Comment #11
clemens.tolboomWe continue this then in issue #1428568: Add use of table format for more then just entity-list.
Comment #11.0
clemens.tolboomUpdated issue summary.