Hi,
I am using modeladmin to filter on a relation id, as specified here:
class RoomAdmin extends ModelAdmin {
public static $managed_models = array('Room'); // Can manage multiple models
static $url_segment = 'roomadmin'; // Linked as /admin/products/
static $menu_title = 'Room rate admin';
}
And filtering criteria are specified here:
public static $searchable_fields = array(
"Name", "Lodge.ID", "Lodge.Destination.ID"
);
I get correct dropdown fields for both Lodge and Lodge's destination, however, when I try to apply the destination filter, I get the following:
[User Error] Couldn't run query: SELECT DISTINCT count(DISTINCT "Room"."ID") AS "0" FROM "Room" LEFT JOIN "Lodge" ON "Lodge"."ID" = "Room"."LodgeID" INNER JOIN "PhysicalLocation" ON "Destination"."ID" = "PhysicalLocation"."ID" LEFT JOIN "Destination" ON "Destination"."ID" = "Lodge"."DestinationID" WHERE ("PhysicalLocation"."ID" LIKE '%1%') Table 'rsc1.destination' doesn't exist
GET /admin/roomadmin/Room?q%5BName%5D=&q%5BLodge__ID%5D=&q%5BLodge__Destination__ID%5D=1&action_search=Apply+Filter
Line 580 in .../framework/model/MySQLDatabase.php
Full code can be seen here: https://gist.github.com/petrklus/6781769