Closed (fixed)
Project:
Examples for Developers
Component:
Node Example
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
28 Mar 2010 at 21:12 UTC
Updated:
29 Oct 2010 at 15:00 UTC
Jump to comment: Most recent file
Testing fails (running locally, or on the bot):
FieldException: Attempt to create an instance of field color without an object type. in field_create_instance() (line 624 of /home/rfay/workspace/d7git/modules/field/field.crud.inc). Fatal error: Exception thrown without a stack frame in Unknown on line 0
Thanks, cyberswat
| Comment | File | Size | Author |
|---|---|---|---|
| #34 | examples.node_example_improvements_755640_34.patch | 5.48 KB | rfay |
| #32 | examples.node_example_508342_32.patch | 22.64 KB | rfay |
| #26 | node_example.patch | 9.94 KB | chx |
| #17 | examples.node_example_broken_755640_17.patch | 8.98 KB | rfay |
| #5 | examples-755640.patch | 793 bytes | cyberswat |
Comments
Comment #1
cyberswat commentedI'll take a look at this asap
Comment #2
rfay@cyberswat, when you look at this could you see if #746266: field_delete_instance in Node Example uninstall is redundant (or perhaps not commented well enough) is a valid bug?
Comment #3
rfayPer cyberswat: tell rfay that if I were to guess about #755640 it is that the cardinality should not be on the $instance but should be on the $field … try removing it from the instance.
Comment #4
arpeggio commentedTry this patch (in line 65 of node_example.install just change the key from object_type to entity_type):
Comment #5
cyberswat commentedLet's see if that makes it through testing
Comment #6
cyberswat commentedComment #7
rfayI ran it locally and it worked fine, so committed to HEAD: http://drupal.org/cvs?commit=352596
Now I'll see if I can convince the bot to test again.
Thanks!
Marking (hopefully) fixed.
Comment #8
rfayYeah, that did it: http://qa.drupal.org/pifr/test/26934 !!!!
Thanks, all.
-Randy
Comment #9
cyberswat commented@arpeggio Thanks a bunch for finding that!
Comment #10
arpeggio commentedYou're welcome. Its my pleasure to help Drupal community.
Comment #11
scallopedllama commentedUmmm... I still get that error when trying to install the module with the latest version.
FieldException: Attempt to create an instance of field color without an object type. in field_create_instance() (line 624 of /.../modules/field/field.crud.inc).
EDIT: In fact, reverting that change (changing $instance['entity_type'] back to $instance['object_type']) makes that error go away for me.
Comment #12
rfay@scallopedllama I just enabled the module and exercised the node-add without trouble.
You may want to uninstall, remove the files, get the latest dev.
Or it could be dependent on your environment or something. In that case, after doing the above, please update!
Comment #14
scallopedllama commentedI guess my problems were coming from the fact I wasn't using the latest dev version of Drupal 7, I had an alpha installed. After upgrading to the latest dev, the error went away.
Comment #16
rfayThis is a new break, but the parties that matter are here.
We get this fatal now when running the tests:
Comment #17
rfayOK, here's what I did.
I have no objection to finding a way back to the "do it all in the install file" technique, but couldn't find the way past the fatal error without doing this.
Let's get it back to the best practice if this is not it.
Thanks!
-Randy
Comment #18
rfayCommitted to HEAD: http://drupal.org/cvs?commit=363812
I'm going to leave this open a while hoping for review from those of you in the know.
Comment #20
webchickOMG SYSTEM MESSAGE HAS BECOME SELF AWARE! ;)
Thanks for posting this, randy. I'm a bit confused, because I never knew of a way to create a node type in a .install file before? hook_node_info(), hook_form(), etc. are the standard way to do this. Hmmm...
Comment #21
catchbook.install uses node_type_save() in hook_install(), why is that not working for you?
Comment #22
rfay@webchick: The discussion about this approach was in #706738: Update the node_example for Drupal 7 and in #508342: D7 Node example demonstrating fields and finally in #763724: Add a D6-style Node Example to the Node Example module.
@catch: I'm really interested in why also. I would also be interested in you weighing in on the best practices view of the two ways of doing this.
Comment #23
catch@rfay: I hate nook_node_type(), and all the stupid hook_$foo() hooks which aren't really hooks, and nearly tried to get rid of core usage of them in that patch because of the weird node_types_rebuild() stuff before chickening out. Not sure if that counts as best practices though ;)
Comment #24
rfayMarking this fixed. If anybody thinks we should be demonstrating a better approach, please say so!
Comment #26
chx commentedI reverted #17 and made node_example install again by adding a body field myself. You tried to update an instance that does not exist. The test says: Node example 18 passes, 0 fails, 0 exceptions, and 5 debug messages
Literally, the only change is adding
node_add_body_field($content_type);To make things more interesting I made a mistake by adding it before the content_type_save and it still worked! Moral of the story: field crud does not give a hoot whether a bundle exists or not, it will happily instance a field to a nonexisting bundle.Comment #27
ilo commentedI love the way this module is built with D7 API, and explanations are clear enough. After manual and simpletest testing without visible errors I'll mark as rtbc.
Comment #28
rfayI would say if you like it and chx likes it, commit it.
Comment #29
rfayUnfortunately, we lost a lot of improvements to the code that have gone on in other issues with this one, so this patch needs to be pared down to just the things that chx wants. I sure appreciate your involvement here, chx.
In at least two places documentation was removed that need not be removed.
Deliberate attempts to demonstrate that functions were private were removed.
Powered by Dreditor.
Comment #30
ilo commentedrfay, I'm going to leave this one for you. Everything about comments and deliberate purposes makes me run.. I'll focus on other issues for now.
Comment #31
rfayYes, you're right, and I should finish this one.
Comment #32
rfayOK, I took chx's patch and made cosmetic changes, keeping the new comments and such that had been added in the meantime. It passes the tests and I think it's good to go. @chx, would appreciate you taking a look. Thanks so much for your investment in this issue. Thanks for pursuing this ilo! We sure want Examples to reflect what the developers consider to be best practices.
Comment #34
rfayWow, I'm baffled what I did with that last patch. Here's another try.
Comment #35
chx commented+ // Define the node type. This is similar to hook_node_info() in Drupal 6
nah. it's just a node type. node_type_save exists since Drupal 5 and has not much to do w hook_node_info, really.
Comment #36
rfayCommitted with chx #35: http://drupal.org/cvs?commit=436532
Thanks so much for your involvement here, chx. It means the world to have quality feedback on these things.