I've tested this on a function returning all kinds of stuff, allways getting the same error. It just seems to be wanting an existing Database field - or a DataList(?) - only.
DataObject.php line 2480
public function relObject($fieldPath) { if(strpos($fieldPath, '.') !== false) { $parts = explode('.', $fieldPath); $fieldName = array_pop($parts); // Traverse dot syntax $component = $this; foreach($parts as $relation) { if($component instanceof SS_List) { if(method_exists($component,$relation)) $component = $component->$relation(); else $component = $component->relation($relation); } else { $component = $component->$relation(); } } $object = $component->dbObject($fieldName); } else { $object = $this->dbObject($fieldPath); } if (!($object instanceof DBField) && !($object instanceof DataList)) { // Todo: come up with a broader range of exception objects to describe differnet kinds of errors programatically throw new Exception("Unable to traverse to related object field [$fieldPath] on [$this->class]"); } return $object; }Also: you can point summary_fields dotnotated to a related class, say
MyImage.Name and that works fine. searchable_fields, however, want to search the actual
table MyImage, which is never created if the MyImage class has no $db fields of its own:
Couldn't run query:
SELECT DISTINCT count(DISTINCT "MyObject"."ID") AS "0"
FROM "MyObject"
LEFT JOIN "MyImage" ON "MyImage"."ID" = "MyObject"."SomeImageID"
INNER JOIN "File" ON "MyImage"."ID" = "File"."ID"
WHERE ("File"."Name" LIKE '%blah%')
Table 'xxxxx.MyImage' doesn't exist
I'd say that's a bug as well, though another one.
Last point: if someone were to actually set $searchable_fields = array(); wouldn't he then expect there to be no filters, logically thinking?
Op zaterdag 1 september 2012 18:03:20 UTC+2 schreef swaiba het volgende: