Closed (fixed)
Project:
Relation
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Anonymous (not verified)
Created:
10 Nov 2011 at 15:34 UTC
Updated:
9 Jan 2019 at 23:51 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Anonymous (not verified) commentedAttached is a one-liner fix.
Comment #2
tenken commentedJust my 2 cents ... I believe the mentality in the Drupalverse is that [node|entity|term]_save() return IDs, not full objects.
So you have 2 options now:
I make many relations with attached fields so I do the 1st scenario often and add fields between consruct() and save() ...
I suppose it may not hurt to return a RID on create(), but then some confusion may arise between save() and create()'s purposes ...
Comment #3
Anonymous (not verified) commented@tenken - Agreed about returning IDs; however, things in the Drupalverse are not so consistent. For example, node_save accepts the node object by reference, so you can always get the nid from the object after calling node_save, while comment_save returns nothing, and user_save returns the full user object.
I do use relation_construct -> relation_save when creating relations that are fieldable, but oftentimes a relation is just the endpoints and that's it.
I guess it's not terribly detrimental to have nothing returned, but in the interest of saving a few lines of code here and there, this might be a good little addition.
Comment #4
chx commentedI reverted the construct - create change.