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.
This issue is transformed into a separate project http://drupal.org/project/drush_entity to continue development.
Watch the video on http://www.youtube.com/watch?v=cVGZzWjdDh8 as an appetiser.
This summary is zapped. To read the unzapped version checkout revision http://drupal.org/node/1005480/revisions/1736582/view
Comment | File | Size | Author |
---|---|---|---|
#43 | drush_el.tar_.gz | 1.37 KB | damiankloip |
#30 | drush-entity-support-1005480-30.patch | 37.18 KB | clemens.tolboom |
#28 | drush-entity-support-1005480-28.patch | 36.86 KB | clemens.tolboom |
#26 | drush-1005480-26-Drush_entity_support.patch | 31.95 KB | helmo |
#21 | drush-1005480-21-Drush_node_support.patch | 16.56 KB | helmo |
Comments
Comment #1
jonhattanFYI: here's an implementation for node-delete: http://elnoti.xsto.info/~jonhattan/node.drush.inc
and also I leveraged node overview filters (what is at admin/content/node in d6) at http://drupal.org/node/766930#comment-3451732 .. it wasn't shipped in that issue's commit.
Comment #2
msonnabaum CreditAttribution: msonnabaum commentedAwesome. New patch adds the node-delete command from the above comment, plus a node-create command.
Seems to have trouble with date fields so far, but it seems to be working otherwise.
Comment #3
moshe weitzman CreditAttribution: moshe weitzman commentedI'd like for us to polish this and commit to Drush5.
Comment #4
greg.1.anderson CreditAttribution: greg.1.anderson commentedAdjusting status...
Comment #5
msonnabaum CreditAttribution: msonnabaum commentedHere's a new version that adds a couple things:
- node-create works with editors now if you don't use STDIN
- node-create and node-edit loosely tested on D7
- Now uses drush_json_encode/decode functions which helps with D7 computability
Comment #6
kotnik CreditAttribution: kotnik commentedOne really minor thing:
You've got trailing whitespace here.
Powered by Dreditor.
Comment #7
kotnik CreditAttribution: kotnik commentedCouldn't you use just:
Instead of copying it into Drush?
Powered by Dreditor.
Comment #8
jonhattannode-delete is implemented this way to prevent calling cache_clear_all() for each node.
Comment #9
kotnik CreditAttribution: kotnik commented@jonhattan: makes sense.
Comment #10
msonnabaum CreditAttribution: msonnabaum commentedHere's what I showed at drupalcon.
Starting to move it over to use entities instead of nodes. The only command that I worked on was edit, the rest are still node specific.
Comment #11
moshe weitzman CreditAttribution: moshe weitzman commentedNot sure it is needed, but probably wise to assure that temp file gets escapeshellarg(). Something like
drush_shell_exec_interactive('$EDITOR %s', $tmpfile);
Mark's demo of these commands at Drupalcon was a big hit. See last 20 mins of our presentation at http://chicago2011.drupal.org/sessions/advanced-drush
Comment #12
moshe weitzman CreditAttribution: moshe weitzman commentedNot sure it is needed, but probably wise to assure that temp file gets escapeshellarg(). Something like
drush_shell_exec_interactive('$EDITOR %s', $tmpfile);
Mark's demo of these commands at Drupalcon was a big hit. See last 20 mins of our presentation at http://chicago2011.drupal.org/sessions/advanced-drush
Comment #13
moshe weitzman CreditAttribution: moshe weitzman commentedTook another look at this. Items to fix up. For testing, the built-in article page type is pretty good. It has body and tags Fields on it.
Comment #14
clemens.tolboomThis should work for nodes only?
A weird alias: entity-show versus ns ... I would suggest ens
Add comment about not using node_delete($nid) for D5/6
Comment #15
thimothoeye CreditAttribution: thimothoeye commentedsubscribe
Comment #16
moshe weitzman CreditAttribution: moshe weitzman commentedAnyone available to push this along?
Comment #17
helmo CreditAttribution: helmo commentedI've coded the comment from clemens.tolboom into a branch of my drush sandbox on top of the patch from #10
To better work together I've granted vcs push privileges to clemens.tolboom.
My sandbox branch: http://drupalcode.org/sandbox/helmo/1277350.git/shortlog/refs/heads/mast...
Comment #18
clemens.tolboomThe commands are not consistent enough:
- entity-show(nids)
- entity-create()
- entity-edit(type, nids)
- entity-delete( nid)
as for D7 we require a type so helmo and clemens suggest to make type required.
For D6 the type is required but only implemented for nodes. At least for now.
So the commands become
- entity-show node 12
- entity-create comment
- entity-edit taxonomy 123
- entity-delete user 12
At least that's the idea for now :)
Comment #19
clemens.tolboomMy (D7) setup
The following commands then function (all D7)
I'm puzzled with the save flow. This works sometimes :(
Comment #20
clemens.tolboom[Note: this is output from drush_helmo sandbox]
I'm not sure how to pipe the output to the next drush command.
This example: print entity ids from all available entities
drush entity-list | drush enity-list
should do the job. Instead I need to rundrush el `drush el`
.Comment #21
helmo CreditAttribution: helmo commentedAfter a lot of work and refactoring of clemens.tolboom and myself in the sandbox branch we feel that this is ready for review.
It includes a testcase with 10 assertions that tests the support for working with node entities in D7.
Comment #22
clemens.tolboomentity-delete only works on node.
The sandbox http://drupalcode.org/sandbox/helmo/1277350.git/shortlog/refs/heads/mast... is updated.
Comment #22.0
clemens.tolboomUpdate to latest implementation.
Comment #23
clemens.tolboomIf fixed the entity delete. It works now for D7.
There is a warning when deleting entities ... not sure what/why?
This is what I did.
Comment #24
helmo CreditAttribution: helmo commentedFixed the array_flip() warning in git, phpunit now runs OK without warnings.
Comment #24.0
helmo CreditAttribution: helmo commentedAdded sandbox link and rephrased what works.
Comment #24.1
clemens.tolboomAdded h4 testcase section.
Comment #24.2
clemens.tolboomAdded some todos
Comment #24.3
helmo CreditAttribution: helmo commentedAdded list of current testcases
Comment #24.4
clemens.tolboomAdded link to sandbox issues.
Comment #25
clemens.tolboomWe could use some feedback on our sandbox.
Comment #26
helmo CreditAttribution: helmo commentedHere is a patchfile of the sandbox progress.
All tests are passing!
Comment #26.0
helmo CreditAttribution: helmo commentedUpdate proposed solution to current state
Comment #27
clemens.tolboomEmpty function
Missing documentation
Remove this code.
Or should we require the --json?
No function documentation.
This documentation is not current. Code is moved into _drush_entity_op
These fixes need more documentation ... especially when adding D8
No function docs
No docs.
Please document the D6 array structure.
Are these settings not derivable from entity_info?
And please check devel_generate.
This construct misses for all other (and new) entity types.
Can't we derive default values from somewhere ... field_info_* and friends?
See drush field* commands?
Comment #27.0
clemens.tolboomUpdate list of tests and options
Comment #28
clemens.tolboomPatch has some of the comments above.
I'm unsure whether out entity-create workflow is satisfying enough ... we still haven't dive into #13 (devel generate)
I like --fields=**/label which extract all label keys.
Comment #29
clemens.tolboomWhile creating a video I noticed (a forgotten) bug multiple value fields are indexed ... [0] seems to get ignored.
Comment #29.0
clemens.tolboomFixed original user.
Comment #29.1
clemens.tolboomAdded link to video.
Comment #29.2
helmo CreditAttribution: helmo commentedUpdated issue summary. Added link to gitweb diff
Comment #29.3
clemens.tolboomReordered some links and added links to video transcript of commands
Comment #30
clemens.tolboomThe latest patch (it's getting bigger)
Some remarks upfront:
- yaml conversion should be place into a drush-lib
- filter_fields should be made available into a drush-lib too.
Both are awesome to analyse data spit out by any drush command ie views
There are still unanswered questioned and tests reported in the issue summary. Feel free to answer these without reviewing the patch. We _need_ some answers :)
Comment #31
moshe weitzman CreditAttribution: moshe weitzman commentedPerhaps msonnabaum can review this, as the original author of this feature. For me, the proposed implementation is a bit too feature rich for core drush.
Comment #32
clemens.tolboom@moshe weitzman please specify this 'too feature rich' a little for us as you spend some time reviewing this :_)
Comment #33
msonnabaum CreditAttribution: msonnabaum commentedI need to dig into this a bit further, but here are some initial comments.
What is this? Why is it necessary?
I don't like the change from "show" change to "read"? I'm ok with arguments against "show", but CRUD is not that intuitive here. Same thing with "update", I'd rather it be "edit".
This function makes me sad. The comment sort of says what it does, but not why it's necessary. Also, it's very long and hard to follow. The comments make no sense to me.
Use drush_set_error instead of drush_die, and wrap these strings with dt(). Also, for the longer callbacks you should use the _validate hook for validation.
In general, most all of it needs more comments that say "why" and not "what".
Also, remove the YAML stuff. It's not necessary. The --json option should change to --format like cache-get, and it should support the same output formats.
Comment #34
barraponto CreditAttribution: barraponto commentedI wouldn't say yaml is not necessary. Instead it might be contributed in a separate patch that takes php objects and turns them into yaml — and we could use it in most of drush commands.
Comment #35
clemens.tolboom@barraponto thanks for the feedback :-)
I still have to dive into the --format
As I hope was clear from my video the yaml output is great for learning the internals so this should be a separate patch #1366098: Automatically download Symfony YAML component.
Comment #36
greg.1.anderson CreditAttribution: greg.1.anderson commentedThe variable-set and variable-get commands parse and print different data formats. That code should be factored out and re-used here, so yaml and other enhancements deemed necessary will be usable in a consistent fashion across the different drush commands where they are relevant.
Comment #37
clemens.tolboom@greg.1.anderson thanks for the hints.
What this means for this issue is I have to build out the yaml output (and probably more output stuff) as #34 first mentioned the --format switch.
I'm puzzled about the --fields ... it is so darn handy too for querying the entity system. My guess now is it should be in a separate issue. Not sure right now ... need some chewing on it :(
Comment #38
damiankloip CreditAttribution: damiankloip commentedI have a small extension I wrote recently (couldn't find it mentioned in this issue) for 'entity-list'. Does what you expect really; provides a table of entities with a count, bundles, base table, etc... This has been useful for me. Is it wanted here? and worth providing a patch for?
Comment #39
clemens.tolboom@damiankloip sounds like a nice extension but not sure how much overlap there is.
We do not have counts so that sound like a nice addition. The output (and workflow) of
is ugly. I'm curious about your output :)
We do have the entity-type-read command which provides for the info (bundle, base table, etc) but presentation has it's value too. I'm not sure whether the example below works right now
drush --format=table entity-type-read user node file --fields="*/bundle,*/base table"
but this should be possible when format related issues like #1366098: Automatically download Symfony YAML component and/or #1396178: Add properties output as a --format get fixed together with the table format.
Ie
drush entity-type-read node file user --fields="base table,bundles" --format=properties
givesWhen patching make sure to use the git sandbox http://drupalcode.org/sandbox/helmo/1277350.git/shortlog/refs/heads/mast...
Helmo and I discussed whether move this patch into a separate project so people can install it easiers. What do you think?
I planned to work on this issue again when building a web spider on top of it. That is trying to clone a website though drush-entity :)
Comment #40
damiankloip CreditAttribution: damiankloip commented@clemens.tolboom I was thinking something simpler (although I like aspects of the above implementation) like views-list does. So an entity-list command that shows alot of this info, including counts, as a table. I didn't realise about the other thread to add a --format option for the output. I was thinking it would be nice to have commands that are easier to use/type too.
Ha, clone website with drush entity :)
Comment #41
clemens.tolboom@damiankloip please provide an example output (or patch :p) ... I did not know views-list so tnx :)
Comment #42
damiankloip CreditAttribution: damiankloip commented@clemens.tolboom No problem. Currently it is in it's own module. I will post this for you to see. I think this is the easiesy way for you to see what it does. If we need to we can then make a patch for the appropriate file?
Comment #43
damiankloip CreditAttribution: damiankloip commentedHere is a small module showing a similar implementation to views-list functionality. I think one of the main benefits is the ease of the command; Just "drush el" or "drush el user,node" for example rather than the current more verbose proposal. I think maybe both have their place?
Let me know what you think!
Comment #44
clemens.tolboom@damiankloip tnx for the code.
Comment #45
damiankloip CreditAttribution: damiankloip commented@clemens.tolboom: Dodgy formatting but yes that is the idea :)
Comment #45.0
damiankloip CreditAttribution: damiankloip commentedPushed #27 into issue summary
Linked to #1330504: Test the File entity
Comment #46
clemens.tolboomWe moved our code to http://drupal.org/project/drush_entity to have better issue management, easy download for interested people and more developers.
Current developers now @helmo @damiankloip @clemens.tolboom ... feel free to join.
I mark this issue postponed (hope it will not hide on the issue overview).
Comment #47
greg.1.anderson CreditAttribution: greg.1.anderson commentedI put a pointer to drush_entity on the Resources page of drush.org. If we bring drush_entity back to core, we can do it via another issue.
Comment #48
clemens.tolboom@greg.1.anderson tnx
Comment #48.0
clemens.tolboomAdded link to project page.
Comment #48.1
clemens.tolboomUpdated issue summary.
Comment #49.0
(not verified) CreditAttribution: commentedUpdated issue summary.