can you add to the end of this function line "return true;" as i did? when i delete rel's with api in ajax i can't check if that action success or failed without this line.

CommentFileSizeAuthor
#2 user_relationships_1740344.patch1.23 KBdrewish
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mrf’s picture

Version: 7.x-1.0-alpha4 » 7.x-1.x-dev
Category: feature » bug

Sounds like a bug to me.

drewish’s picture

Category: bug » feature
Status: Active » Needs review
FileSize
1.23 KB

How's this look? I wouldn't call it a bug before because there was no result documented so it was working as designed.

drewish’s picture

Title: user_relationships_delete_relationship() » user_relationships_delete_relationship() should return result of DeleteQuery::execute()
b8x’s picture

looks good

Berdir’s picture

@drewish: Thanks for working on this project. I'm going to be more or less offline for the next three weeks, but I'll look at your patches when I'm back.

Berdir’s picture

Note the the return value of db_delete()->execute() is defined as "Depends on the database". I'm not sure if we can rely on this as this patch is trying to do.

drewish’s picture

Right that's exactly why I documented the return value as coming from DeleteQuery::execute(), so people can dig into it if they really need to know what it'll be. But that said my understanding is core's database layers return truthy values.

I don't see the harm in bubbling the result up, but I don't think it makes any sense to return a hard coded TRUE value.

b8x’s picture

If at least some kind of mistake will be, f-tion will fail and return the no result. Maybe the error is with the object $relationship. to be correct, check whether the object is removed must be in the same f-tion, why not. Simple db_seleсt(). if you want to just make sure that the link is removed.