Hi,
I'm having an sql error with ManyManyDataObject Manager where the dataobject contains an image.
If I use a ManyManyComplexTable field, the admin works fine. However, on changing that to a DataObjectManager, I get an sql error. My DataObject is defined as follows:
class Sponsor extends DataObject {
static $db = array(
'Name' => 'Text',
'URL' => 'Text'
);
public static $has_one = array(
'Logo' => 'Image'
);
public static $belongs_many_many = array(
'EventDetails' => 'EventDetail'
);
...
}
the error I get is:
[User Error] Couldn't run query: SELECT `Sponsor`.*, `Sponsor`.ID, if(`Sponsor`.ClassName,`Sponsor`.ClassName,'Sponsor') AS RecordClassName, Logo, IF(`EventDetailID` IS NULL, '0', '1') AS Checked FROM `Sponsor` LEFT JOIN `EventDetail_Sponsors` ON (`Sponsor`.`ID` = `SponsorID` AND `EventDetailID` = '15') GROUP BY `Sponsor`.ID ORDER BY SortOrder ASC LIMIT 0, 10 Unknown column 'Logo' in 'field list'
If in EventDetail.php I change the dataobject constructor from
$tablefield = new ManyManyDataObjectManager(
$this,
'Sponsors',
'Sponsor',
array(
'Name' => 'Name',
'URL' => 'URL',
'Logo' => 'Logo'
),
'getCMSFields_forPopup'
);
to
$tablefield = new ManyManyDataObjectManager(
$this,
'Sponsors',
'Sponsor',
array(
'Name' => 'Name',
'URL' => 'URL',
'LogoID'=> 'Logo'
),
'getCMSFields_forPopup'
);
(i.e., change "Logo" to "LogoID") Then I no longer get the error - but I can't see my image thumbnail in the table.
Any ideas on how I can resolve this?