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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Preview: DataObjectManager module

Go to End

379 Posts   75665 Views


Community Member, 49 Posts

20 March 2009 at 4:28am

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.


Forum Moderator, 4102 Posts

20 March 2009 at 7:19am

Edited: 20/03/2009 7:20am

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.


Community Member, 119 Posts

23 March 2009 at 10:55pm

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


Community Member, 21 Posts

23 March 2009 at 11:57pm

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.



Forum Moderator, 4102 Posts

24 March 2009 at 2:36am

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

Community Member, 181 Posts

24 March 2009 at 5:16am

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?



Forum Moderator, 4102 Posts

24 March 2009 at 5:19am

Can you show me QualityChildPage?

Ben Gribaudo

Community Member, 181 Posts

24 March 2009 at 5:27am

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;

Go to Top