function onBeforeWrite() { // Move to Photo Gallery Holder if created under something else if ($this->Parent()->ClassName != "PhotoGalleryHolder" && PhotoGalleryHolder::get()->count() > 0) { $this->ParentID = PhotoGalleryHolder::get()->first()->ID; } parent::onBeforeWrite(); }
function ChildHolders() { return PhotoGalleryHolder::get()->filter(array("ParentID" => $this->ID)); }