Download & Extend

Relation is never saved

Project:Subuser
Version:7.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:reviewed & tested by the community

Issue Summary

Hi
In the submit function you're calling relation_create('subuser', $endpoints); however this returns a relation - but does not save it (looking at 7.x-1.0-alpha3 of relation module).
We need to change it to call relation_save on the returned relationship in order for it to work.
Patch attached.

Lee

AttachmentSize
subuser-relation-save.patch604 bytes

Comments

#1

#2

Status:needs review» reviewed & tested by the community

Patch applied and creating subusers like a champ now!

#3

Using the latest development version of the Relations module.
Should it be relation_construct() instead of relation_create()?

#4

#3: no, relation_construct() doesn't exist anymore.

(Google gives #1337740: relation_create should return relation object which also gives a hint as to why relation_save() might not need to be called at some time in the past, but it does now...)

so RTBC +1.

#5

Ahem. Above code, works but the relation is still saved incorrectly... The relation_revision.rid DB field is always set to 0.

The cause is not here, but in the relation module. See #1396678: RID not saved in revision table when new relation is saved.
Until that patch is applied, #1213566: Add View/Edit/Delete Functionality (subuser.module) will not work.

Please note that until #1204692: Change default views to reflect upstream changes to VBO + relation (subuser.module) is updated, you should not use the latest -dev version from relation, since it will break the default view. Instead use relation-7.x-1.0-beta3 with the patch in #1396678: RID not saved in revision table when new relation is saved.