Select is not working for a BelongsToMany relationship in RelationManager
I have a Team model which has a BelongsToMany relationship with Products, including a pivot table:
and vice versa in Product:
In my TeamResource I've added:
And I created a ProductsRelationManager:
The problem is, no matter how I configure the Select, I either can't get any results or I get the error "Call to a member function getResults() on null"
The question therefore is, how can I correctly edit the Product which is attached to the Team using a Select?
6 Replies
I had a similar problem that was just solved (in my case I couldn't edit the item without getting that error). It was fixed by removing the "select" statement in the RelationManager.
Sorry, I don't follow. Do you mean you could not use Select at all?
Correct. I'm not sure if you're having exactly the same problem (and I'm new at all this), but removing the select statement fixed the problem for me.
Ah ok, thanks. Unfortunately that isn't a solution here, I need the ability to adjust the Produch which is assigned to the Team.
Good luck!
I've used a select without relations and used directly
options(fn($state):string => ....query.... )