Jump to content


infinitesunrise's Content

There have been 1 items by infinitesunrise (Search limited from 22-January 20)


By content type

See this member's

Sort by                Order  

#149630 set_relation_n_n doesn't work with custom callbacks

Posted by infinitesunrise on 03 January 2020 - 04:54 PM in Bugs / Issues

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.