Getting owner record in custom association action
Hello all,
I have a book and story tables with a pivot table between the two. I have relationship manager to handle associating and dissociating books and stories. But the pivot table also has other data that needs to be entered when creating an association (order).
So I have overridden the form for the associate action like so:
I am now trying to save all this stuff, but I cannot seem to retrieve the Book I'm currently editing inside the action. Is there a way to do so?
1 Reply
got it, I just used
$this->getOwnerRecord()
and then attached the value with the extra values for the pivot table xD
Is there another way that would allow me to avoid overriding this behaviour, though ? I have many relationships with this kind of requirements...
and same thing with dissociate action; it doesn't seem to work as intended but tries to call dissociate (I'd like it to use detach 😦 )