Hi all,
I run into a problem with inheritance. It's quite simple but perhaps this isn't possible - I'll try to explain it:
I've got one class "BackgroundPage" which extends Page and has a has_many relation to a data object.
I've got another class "TilePageCategory" which extends "BackgroundPage" with it's own has_many relationship to a SiteTree class.
class BackgroundPage extends Page {
static $has_many = array(
'Backgrounds' => 'Background'
);
}
class TilePageCategory extends BackgroundPage {
static $allowed_children = array( 'TilePageHolder' );
static $has_many = array (
'TilePageHolders' => 'TilePageHolder'
);
}
So an instance of TilePageCategory should be able to call
$this->Backgrounds()
and$this->TilePageHolders()
But it isn't. The resulting componentSet instances are empty (I just get the instance's skeleton):
print_r($this->TilePageHolders()) gives me:
ComponentSet Object
(
[type:protected] => 1-to-many
[ownerObj:protected] => TilePageCategory Object
(
[destroyed] =>
[record:protected] => Array
(
[ClassName] => TilePageCategory
[Created] => 2010-12-06 10:56:56
[LastEdited] => 2011-01-11 14:18:10
[URLSegment] => projekte
[Title] => PROJEKTE
[MetaTitle] => Bauten
[ShowInMenus] => 1
[ShowInSearch] => 1
[ProvideComments] => 0
[Sort] => 2
[HasBrokenFile] => 0
[HasBrokenLink] => 0
[Status] => Published
[CanViewType] => Inherit
[CanEditType] => Inherit
[Version] => 7
[Priority] => 1.0
[ParentID] => 0
[ID] => 6
[RecordClassName] => TilePageCategory
)
[changed:DataObject:private] => Array
(
)
[original:protected] => Array
(
[ClassName] => TilePageCategory
[Created] => 2010-12-06 10:56:56
[LastEdited] => 2011-01-11 14:18:10
[URLSegment] => projekte
[Title] => PROJEKTE
[MetaTitle] => Bauten
[ShowInMenus] => 1
[ShowInSearch] => 1
[ProvideComments] => 0
[Sort] => 2
[HasBrokenFile] => 0
[HasBrokenLink] => 0
[Status] => Published
[CanViewType] => Inherit
[CanEditType] => Inherit
[Version] => 7
[Priority] => 1.0
[ParentID] => 0
[ID] => 6
[RecordClassName] => TilePageCategory
)
[components:protected] =>
[brokenOnDelete:protected] =>
[brokenOnWrite:protected] =>
[componentCache:protected] => Array
(
[Backgrounds_948a13f1eb402f8ff16472e217608fb6] => ComponentSet Object
(
[type:protected] => 1-to-many
[ownerObj:protected] => TilePageCategory Object
*RECURSION*
[ownerClass:protected] => TilePageCategory
[tableName:protected] =>
[childClass:protected] => Background
[joinField:protected] => BackgroundPageID
[items:protected] => Array
(
)
[odd:protected] => 0
[first:protected] => 1
[last:protected] =>
[current:protected] =>
[pageStart:protected] =>
[pageLength:protected] =>
[totalSize:protected] =>
[paginationGetVar:protected] => start
[iteratorPos:protected] =>
[iteratorTotalItems:protected] =>
[failover:protected] =>
[customisedObject:protected] =>
[objCache:ViewableData:private] => Array
(
)
[class] => ComponentSet
[extension_instances:protected] => Array
(
)
)
[TilePageHolders_948a13f1eb402f8ff16472e217608fb6] => ComponentSet Object
*RECURSION*
)
[iteratorPos:protected] =>
[iteratorTotalItems:protected] =>
[failover:protected] =>
[customisedObject:protected] =>
[objCache:ViewableData:private] => Array
(
)
[class] => TilePageCategory
[extension_instances:protected] => Array
(
[GoogleSitemapDecorator] => GoogleSitemapDecorator Object
(
[owner:protected] =>
[ownerBaseClass:protected] => SiteTree
[ownerRefs:Extension:private] => 0
[class] => GoogleSitemapDecorator
)
[Hierarchy] => Hierarchy Object
(
[markedNodes:protected] =>
[markingFilter:protected] =>
[_cache_numChildren:protected] =>
[owner:protected] =>
[ownerBaseClass:protected] => SiteTree
[ownerRefs:Extension:private] => 0
[class] => Hierarchy
)
[Versioned] => Versioned Object
(
[stages:protected] => Array
(
[0] => Stage
[1] => Live
)
[defaultStage:protected] => Stage
[liveStage:protected] => Live
[migratingVersion] =>
[owner:protected] =>
[ownerBaseClass:protected] => SiteTree
[ownerRefs:Extension:private] => 0
[class] => Versioned
)
)
)
[ownerClass:protected] => TilePageCategory
[tableName:protected] =>
[childClass:protected] => TilePageHolder
[joinField:protected] => TilePageCategoryID
[items:protected] => Array
(
)
[odd:protected] => 0
[first:protected] => 1
[last:protected] =>
[current:protected] =>
[pageStart:protected] =>
[pageLength:protected] =>
[totalSize:protected] =>
[paginationGetVar:protected] => start
[iteratorPos:protected] =>
[iteratorTotalItems:protected] =>
[failover:protected] =>
[customisedObject:protected] =>
[objCache:ViewableData:private] => Array
(
)
[class] => ComponentSet
[extension_instances:protected] => Array
(
)
)
Any ideas?