I'm trying to make simple use of the DataObjectManager, I need Date, Title, and a PDF file upload. I've got it working apart from everytime I save, it doesn't save the date, only the title. This is my code...
PdfFile.php:
<?php
class PdfFile extends DataObject
{
static $db = array (
'Date' => 'Date',
'Title' => 'Text'
);
static $has_one = array (
'PDF' => 'File',
'FilePage' => 'FilePage'
);
public function getCMSFields_forPopup()
{
$dateField = new DateField('Date');
$dateField->setConfig('showcalendar', true);
return new FieldSet(
$dateField,
new TextField('Title'),
new FileField('PDF')
);
}
}
?>
FilePage.php:
<?php
class FilePage extends Page
{
static $db = array (
);
static $has_one = array (
);
static $has_many = array (
'PdfFiles' => 'PdfFile'
);
public function getCMSFields()
{
$f = parent::getCMSFields();
$f->addFieldToTab("Root.Content.PDF", new DataObjectManager(
$this,
'PdfFiles',
'PdfFile',
array('Date'=>'Date', 'Title'=>'Title'),
'getCMSFields_forPopup'
));
return $f;
}
}
class FilePage_Controller extends Page_Controller {
}
?>
Any advice would be much appreciated!
Many thanks,
Vic