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

ManyManyDataObjectManager not grabbing the Title correctly


Go to End
Reply


10 Posts   1812 Views

Avatar
MarcusDalgren

Community Member, 288 Posts

29 June 2009 at 10:23am

Hello.

I just set up a ManyManyDataObjectManager instead of the complextablefield and I am having the strangest issue ever.
The object in question inherits Sitetree directly so the fields I've got access to are the ones in the Sitetree table.

Now if I set the field to anything but Title, it displays the value from that field but if I set the value to Title it displays the id with a # in front.

Right now it looks like this and it works the way you'd expect. However if I switch out URLSegment for Title it all goes bonkers. If I grab the tables ID or anything else that works fine as well.

$modulesTablefield = new ManyManyDataObjectManager(
$this,
'Products',
'ProductPage',
array(
       'URLSegment' => 'Title', 'Created' => 'Created'
), 'getCMSFields_forPopup');
$modulesTablefield->setAddTitle( 'A Product' );

$fields->addFieldToTab( 'Root.Content.Products', $modulesTablefield );

return $fields;
   }


If I run this as a regular ManyManyComplexTableField I get the title the way I should so I'm thinking it's something the class does.

Any ideas?

Kindly, Marcus.

Avatar
UncleCheese

Forum Moderator, 4096 Posts

29 June 2009 at 11:45am

That's a really old bug. When did you last update your code?

Avatar
MarcusDalgren

Community Member, 288 Posts

29 June 2009 at 7:25pm

Umm I downloaded the latest code yesterday and ran it on my computer.
I will try again now with the latest code but as far as I know, I was running the latest stable release.

Since I'm new to Silverstripe the oldest code I could be running would be about a week old.

I'll report back with my results.

Avatar
Hubertus

Community Member, 14 Posts

3 July 2009 at 7:47am

I've the same problem, using both the latest built available here and a fresh svn co. (rev 202). Any chance to fix this?
Thanks!

Avatar
UncleCheese

Forum Moderator, 4096 Posts

3 July 2009 at 8:17am

Wow.. Thank God for SVN. I was able to track down the change I made several months ago and see that, while it had been applied to MMDOM, i had pasted it in above the old code rather than replacing it, so it was running correctly, then undoing itself.

Give it an update and see what happens.

Avatar
Hubertus

Community Member, 14 Posts

3 July 2009 at 8:29am

Thanks for the quick reply!

Unfortunately, this is what happens at rv 203:

[Notice] Undefined variable: items
GET /admin/?flush=1

Line 105 in /Users/Hubertus/Sites/30tage/dataobject_manager/code/HasManyDataObjectManager.php

Again, thanks for your help!

Avatar
UncleCheese

Forum Moderator, 4096 Posts

3 July 2009 at 8:43am

Hmm.. I don't have a testing environment set up for MMDOM.. so I'll have to use you. Try now?

Avatar
Hubertus

Community Member, 14 Posts

3 July 2009 at 8:49am

Admin page loads with DOM, but we're back to original problem: title not picked up, instead table shows "#ID" with ID being the number. My custom getter doesn't work either...
Thanks!

Go to Top