7913 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » From ManyManyComplexTableField to ManyManyDataObjectManager
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 1180 Views |
-
From ManyManyComplexTableField to ManyManyDataObjectManager

18 September 2010 at 8:44pm
Hi there,
This is my first foray into the dataobjectmanager and I'm having a little trouble. I have a working $many_many $belongs_many_many relationship going and I have a ManyManyComplexTableField to manage the relationship.
It works well but I'm keen to get the filter/search features of the DOM.So started out replacing this:
function getCMSFields() {
$fields = parent::getCMSFields();
$tablefield = new ManyManyComplexTableField (
$this,
'Bills',
'Bill',
array(
'Type' => 'Type',
'Total' => 'Total',
'Date' => 'Date',
),
'getCMSFields_forPopup'
);
$tablefield->setAddTitle( 'A Bill' );$fields->addFieldToTab( 'Root.Content.Bills', $tablefield );
return $fields;
}with this:
function getCMSFields() {
$fields = parent::getCMSFields();
$tablefield = new ManyManyDataObjectManager (
$this,
'Bills',
'Bill',
array(
'Type' => 'Type',
'Total' => 'Total',
'Date' => 'Date',
),
'getCMSFields_forPopup'
);
$tablefield->setAddTitle( 'A Bill' );$fields->addFieldToTab( 'Root.Content.Bills', $tablefield );
return $fields;
}but I get an error when accessing the cms that I think is about a missing 'IF' argument but can't quite tell:
[User Error] Couldn't run query: SELECT "Bill"."ClassName", "Bill"."Created", "Bill"."LastEdited", "Bill"."Total", "Bill"."Type", "Bill"."Date", "Bill"."ID", CASE WHEN "Bill"."ClassName" IS NOT NULL THEN "Bill"."ClassName" ELSE 'Bill' END AS "RecordClassName", IF(`Flatmate_Bills`.`FlatmateID` IS NULL, '0', '1') AS Checked FROM "Bill" LEFT JOIN `Flatmate_Bills` ON (`Bill`.`ID` = `BillID` AND `Flatmate_Bills`.`FlatmateID` = '5') GROUP BY "Bill"."ClassName", "Bill"."Created", "Bill"."LastEdited", "Bill"."Total", "Bill"."Type", "Bill"."Date", "Bill"."ID", CASE WHEN "Bill"."ClassName" IS NOT NULL THEN "Bill"."ClassName" ELSE 'Bill' END LIMIT 0, 10 | no such function: IF
It would be great to get a little insight as to where i'm going wrong!
thanks
Bernie
-
Re: From ManyManyComplexTableField to ManyManyDataObjectManager

25 September 2010 at 4:41am
You're using MySQL?
--------------------
SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com -
Re: From ManyManyComplexTableField to ManyManyDataObjectManager

27 September 2010 at 9:55am
Oh man, yeap I was using sqlite - thanks!
| 1180 Views | ||
|
Page:
1
|
Go to Top |

