Hi, I have a couple of related pagetypes which I need to draw dataObjectSets from and paginate the results:
BrandCategoryPage.php
class BrandCategoryPage extends Page {
static $many_many = array('BrandPages' => 'BrandPage');
}
function getCMSFields() {
$f = parent::getCMSFields();
$areasTablefield = new ManyManyComplexTableField(
$this,
'BrandPages',
'BrandPage',
array(
'Title' => 'Title'
),
'getCMSFields_forPopup'
);
$areasTablefield->setAddTitle( 'Brands' );
$f->addFieldToTab( 'Root.Content.Brands', $areasTablefield );
return $f;
}
and BrandPage.php
class BrandPage extends Page {
static $has_one = array(
'Logo' => 'Image'
);
static $belongs_many_many = array(
"BrandCategoryPages" => "BrandCategoryPage"
);
function getCMSFields() {
$f = parent::getCMSFields();
$f->addFieldToTab("Root.Content.Images", new ImageField('Logo'));
return $f;
}
what i wanted to do was something like this:
function BrandPages_Paged() {
if(!isset($_GET['start']) || !is_numeric($_GET['start']) || (int)$_GET['start'] < 1) $_GET['start'] = 0;
$SQL_start = (int)$_GET['start'];
$doSet = DataObject::get(
$callerClass = "BrandPage",
$filter = "BrandCategoryID=$this->ID",
$sort = "",
$join = "",
$limit = "{$SQL_start},2"
);
return $doSet ? $doSet : false;
}
but this throws errors....
Anyone know how I can relate back to the category this way?
Cheers