Jump to content


set_relation_n_n doesn't work with custom callbacks

set_relation_n_n

  • Please log in to reply
No replies to this topic

#1 infinitesunrise

infinitesunrise

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 03 January 2020 - 04:54 PM

I have a database that uses a custom notes system quite extensively for leaving custom comments on arbitrary records: The database has a "notes" table with columns for note id, table name, and note contents - I then utilize Grocery CRUD's callback functions to allow my users to create an unlimited number of custom notes for any records in supported tables upon record insert or update, and I also use delete callbacks to clean up associated notes. It's been working quite well so far, we're leaving notes on everything!

 

However I was recently asked to add an n-n relationship between two tables. I said no problem, we can do that with set_relation_n_n. But upon going to implement the relation I am getting "An error occurred on saving" when trying to insert, and a success message when updating but without any actual updates happening. I suspected that set_relation_n_n uses it's own callbacks to work it's magic, so out of curiosity I commented out all of my own note-related callbacks and tada! The relation started working. Problem: I need both the notes and the relation to work at the same time.

 

Am I correct that there is an undocumented incompatibility between callbacks and set_relation_n_n? And if so is there any known workaround? Thanks in advance for any and all help.







Also tagged with one or more of these keywords: set_relation_n_n

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users