ok I have checked the names and now have.
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();
$imagemanager = 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",$imagemanager);
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 dropped the imagetet table and rebuilt database.
Now when I click on Imagetest page in CMS it does not load at all?
why would this work for filedataobjectmanager and not image one?
Is there anytutorial on specifically the imagedataobjectmanager?