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

DOM on site frontend


16 Posts   2572 Views

Capt. Morgan

25 March 2011 at 8:09am Community Member, 30 Posts

I have it and running on my site since a little more than a week back. I have done the work around I described above to get the parent relation working. I also override the template to remove a few elements I don't use and tweak it to fit in better on my site. When I put it on the live hosting I also ran in to some issues discussed in this thread [url][/url] that required some template fixes as well. But those are not distinct DOM issues.

If you're interested in seeing my result, it's on [url][/url] when you sign in and create a toplist.


30 March 2011 at 11:54am Community Member, 121 Posts

nice. good work capt morgan

I tried the site, good job and good idea. it seems though I cant add a new movie only get one from the search engine. Is that right?

how did you get that search working anyway, seems to be the other biggest missing piece is SS is a search engine for all dataobjects not just page content


Capt. Morgan

31 March 2011 at 9:30am Community Member, 30 Posts

Thanks Will, I'm glad you like the site. I'm sorry to dissapoint you about the search though. It's not a search among the data objects. The data object itself is just a holding a reference to a movie at imdb. I figure it's better to piggyback on that database than to build my own. That's why you can't add movies, just search for existing ones. The data objects just hold a reference to the movie.

I believe it would not be too much of a difference to search among local data objects. I just added an ajax request to a controller delivering search results. Wouldn't be much difference to redirect that to search a local database. Tricky part would be to get something working out of the box I guess.


31 March 2011 at 10:03am Community Member, 121 Posts

thats a cool idea. has imdb got an api of some kind then where you can use their search results?

Capt. Morgan

1 April 2011 at 6:49am Community Member, 30 Posts

No official... so shhh..

How is it going with your front end implementation of DOM?


1 April 2011 at 12:10pm Community Member, 121 Posts

good work, ha

my front end work on that is on hold for now. I'm looking at building a social network from Silverstripe and now I've come to the conclusion that the friendship link is going to be the hardest part so focusing on that for now.

Everything else is possible even if it will take some work. However the link from member to member which I first thought was a fairly simple many to many link is what I have been thinking about. I realised the link isn't just boolean as there are more possiblities such as isInvited, invitedYou, acceptedYou, youAcceptedThem as the very basics. I was thinking of creating another class for the for example 'FriendShipLink' but I need to test to see whether SS framework will accept this or crash. I'm trying to plan it out as much as I can before I start coding because I know this could be a really big project


11 May 2011 at 11:23pm Community Member, 150 Posts

Dear Capt.Morgan,

I'm slowly making progress using your suggested work-around. Only here I'd like to add a front-end DOM (Projects) to Member (in this case an extension of Member: CustomMember).

My problem: the relation is not being set when I add a new DOM-item (in this case: Project). HOWEVER, if I click on the item I have just added to edit it and then hit save in the DOM fancybox, it actually DOES add the MemberID to the Project.

What should I change/try? See my code below, many thanks in advance for your help!!!


// mysite/code/CustomMember.php

class CustomMember extends DataObjectDecorator {
   function extraStatics() {
      return array(
         'db' => array(
            'MotekAccountID' => 'Text',
            'CompanyDuplicate' => 'Text',
            'PublicProfile' => 'HTMLText',
            'PublicProjects' => 'HTMLText'
'has_many' => array(
       'Projects' => 'Project'

function updateForumFields(FieldSet $fields) {

      $dom = new DataObjectManager(


   return $fields;






class Project extends DataObject
   static $db = array (
'Title' => 'Varchar'

   static $has_one = array (
      'Member' => 'Member'

   public function getCMSFields_forPopup() {
      return new FieldSet(
new TextField('Title')

public function __construct( $record = null, $isSingleton = false ) {
parent::__construct( $record, $isSingleton );

$id = Member::currentUserID();
   $this->MemberID = $id;




31 March 2012 at 12:26am Community Member, 218 Posts

Hmmmm I have it almost working. Well I can add objects via the frontend DOM now, but I cant figure out the relationships.

here's my code:

   function RatesForm(){
   $Apartment = $this->getApartment();   
   $Manager = new DataObjectManager(
      array('dateStart' => 'dateStart'),
      'ApartmentID = ' . $Apartment->ID

   $Manager->setPermissions(array("show","edit", "add"));   
   $fields = new FieldSet(
   if($Apartment)   {
   $fields->push(new HiddenField('ID','ID',$Apartment->ID));
   return new Form($this->dataRecord, 'RatesForm', $fields, new FieldSet());

So that lists all the rates related to this apartment fine, but I can't edit them, clicking them throws up this error: [Notice] Trying to get property of non-object which is because I have the filter in there based on a $this request for apartment. as soon as you click the dataObject the URL changes and as a result there's no apartment to get an ID from.
As you can see I've put the Apartment ID into the form with a hidden field, but I can't figure out how to pass that to the DOM pop up.... if I take out the filter I can add/edit rates fine, but I need to make sure the user only see's the rates related to this apartment. I hope that makes sense!

can anybody shed any light on this?

P.S - my pop up still doesn't work either, it just opens a new page with the form fields, but I assume that can be fixed later, the pop up doesn't matter to the actual functionality, right?