That would be great. really appreciate it.
ok here are three files that I am trying to get to work with imageDataObjectManager.
(It works to the extent that the images appear in the CMS and I can upload images... although it says error on upload. Also seems to pick up all the images already uploaded for another section.... )
when I try to edit image I get this error
"
[User Error] Couldn't run query: SELECT `Imagetest`.*, `Imagetest`.ID, if(`Imagetest`.ClassName,`Imagetest`.ClassName,'Imagetest') AS RecordClassName FROM `Imagetest` WHERE (ParentID = '15') Unknown column 'ParentID' in 'where clause'
"
when I view my ImagetestPage.ss type page i get this error
"
[User Error] Couldn't run query: SELECT `Imagetest`.*, `Imagetest`.ID, if(`Imagetest`.ClassName,`Imagetest`.ClassName,'Imagetest') AS RecordClassName FROM `Imagetest` WHERE (ParentID = '15') Unknown column 'ParentID' in 'where clause'
GET /SilverStripe2/new-imagetestpage/
Line 401 in C:\wamp\www\SilverStripe2\sapphire\core\model\MySQLDatabase.php
"
here are the files..
ImageTest.php
<?php
class Imagetest extends DataObject
{
static $db = array (
'Name' => 'Text',
'Description' => 'Text',
'Category' => "Enum('Industry, Finance, Education')"
);
static $has_one = array (
'ImagetestPage' => 'imagetestPage',
'Attachment' => 'Image'
);
public function getCMSFields_forPopup()
{
return new FieldSet(
new TextField('Name'),
new TextareaField('Description'),
new DropdownField('Category','Category', singleton('Imagetest')->dbObject('Category')->enumValues()),
new FileIFrameField('Attachment')
);
}
}
?>
ImageTestPage.php
<?php
class ImagetestPage extends Page
{
static $has_many = array (
'Imagetests' => 'Imagetest'
);
public function getCMSFields()
{
$f = parent::getCMSFields();
$manager = new ImageDataObjectManager(
$this, // Controller
'Imagetests', // Source name
'Imagetest', // Source class
'Attachment', // File name on DataObject
array(
'Name' => 'Name',
'Description' => 'Description',
'Category' => 'Category'
), // Headings
'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
// Filter clause
// Sort clause
// Join clause
);
$f->addFieldToTab("Root.Content.Imagetests",$manager);
return $f;
}
}
class ImagetestPage_Controller extends Page_Controller {
}
?>
and ImageTestPage.ss
<% if Menu(2) %>
<ul id="Menu2">
<% control Menu(2) %>
<li class="$LinkingMode"><a href="$Link" title="Go to the $Title page">$MenuTitle</a></li>
<% end_control %>
</ul>
<% end_if %>
<div id="Content" class="typography">
<% if Level(2) %>
<div class="breadcrumbs">
$Breadcrumbs
</div>
<% end_if %>
<h1>$Title</h1>
<% control Imagetests %>
$Description
<% end_control %>
$Content
</div>
...I really appreciate your help. Am I confusing dataobject names with table names? i am clearly a bit confused.