Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

DataObjectManager Module

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Preview: DataObjectManager module


379 Posts   61695 Views


20 March 2009 at 4:28am Community Member, 49 Posts

bgribaudo, in my code and all the examples i have seen it is required to have a reference to your page type from the resource object. Are you sure you shouldn't have something like

class QualityPDF extends PDFResource
static $has_one = array (
'Page' => 'QualityPDFPage '

and then you could setParentClass('QualityPDFPage')

Good Luck, I'm no expert.


20 March 2009 at 7:19am (Last edited: 20 March 2009 7:20am), 4085 Posts

Yeah, the parent class has to be the one that's in your has_one relationship. Put it this way.. setParentClass() tells the table which ID field it will update. so setParentClass('Page') means it will try to update PageID on the object. setParentClass('QualityPDFPage') will try to update the field QualityPDFPageID.

@David -- Thanks for these fixes. I've checked them in.


23 March 2009 at 10:55pm Community Member, 119 Posts

Not sure if this has been posted but here is the link to the module on the unsuported modules page


23 March 2009 at 11:57pm Community Member, 21 Posts

There is a "small bug" behind the links on page navigation for lists. The parameters of First, Next, Previous an Last are twice in parameter string.



24 March 2009 at 2:36am 4085 Posts

Hey! Look at that! It got posted. Finally. Still waiting for the ImageGallery to get some love.

@hu - Thanks for the heads up. I'll look at that.

Ben Gribaudo

24 March 2009 at 5:16am Community Member, 181 Posts

Uncle Cheese,

I think I'm missing something. I'm setting setParentClass('Page') on the FileDataObjectManager instance, yet PDFResource's PageID column stays set at 0. Any clues?



24 March 2009 at 5:19am 4085 Posts

Can you show me QualityChildPage?

Ben Gribaudo

24 March 2009 at 5:27am Community Member, 181 Posts

Sure thing.

class QualityChildPage extends Page {
   static $db = array('Category' => "Enum('Links, Workplace, Family, Stories, Extras','Links')");
   static $default_parent = 'QualityHomePage';
   static $can_be_root = false;
   static $allowed_children = array();
   static $icon = "themes/memberscf/images/pageicons/cqarticle";

   function getCMSFields() {
      $fields = parent::getCMSFields();

      $fields->addFieldToTab('Root.Content.Metadata', new DropdownField('Category', 'Category', singleton('QualityChildPage')->dbObject('Category')->enumValues()));
      return $fields;
   function Quality() {
      return $this->Parent()->Quality;

class QualityChildPage_Controller extends Page_Controller {
   protected $sidebar = 'QualitySideBar';

public function CategoryLinks($category) {
return QualityHelper::CategoryLinks($category, $this->Parent());

class QualityHelper {
   public static function CategoryLinks($category, $quality) {
$results = new DataObjectSet();
foreach($quality->Children() as $child) {
if ($child->Category != $category) continue;

return $results;