hi,
class Program extends DataObject {
...
static $has_one = array(
'Acount' => 'Account'
);
static $belongs_many_many = array(
'Categories' => 'CategoryPage',
);
static $searchable_fields = array (
'program_id' => array(
'title' => 'Program ID',
'field' => 'NumericField',
'filter' => 'PartialMatchFilter'
),
'name' => array('title'=>'Programmname'),
'URLSegment' => array('title'=>'URL Segment'),
'description' => array('title'=>'Beschreibung'),
'Categories.ID' => array('title' => 'Kategorie'),
'Account.ID' => array('title'=>'Account')
);
I have some problems with the 2 last entries in searchable_fields. For the categories I get dropdownfield with all Categories, but if I perform a search it results in an sql error. It only works if I use "Categories.Name", but then I get a textfield instead a dropdown.
Error: "Couldn't run query: SELECT DISTINCT count(*) FROM "Program" INNER JOIN "CategoryPage_Programs" AS "CategoryPage_Programs"
ON "CategoryPage_Programs"."ProgramID" = "Program"."ID" LEFT JOIN "SiteTree" AS "SiteTree"
ON "CategoryPage_Programs"."CategoryPageID" = "SiteTree"."ID" WHERE ("CategoryPage"."ID" IN ('21'))
Unknown column 'CategoryPage.ID' in 'where clause'" at line 525 of /var/www/xxx/sapphire/core/model/MySQLDatabase.php
And the "Account.ID" also returns a dropdown as expectet, but the dropdown shows me only the IDs instead of the Account Names.
Whats wrong here?
thx