Jump to:

7939 Posts in 1472 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » ManyManyDataObjectManager not grabbing the Title correctly

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1 2
Go to End
Author Topic: 1521 Views
  • MarcusDalgren
    Avatar
    Community Member
    288 Posts

    ManyManyDataObjectManager not grabbing the Title correctly Link to this post

    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.

  • UncleCheese
    Avatar
    4085 Posts

    Re: ManyManyDataObjectManager not grabbing the Title correctly Link to this post

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

  • MarcusDalgren
    Avatar
    Community Member
    288 Posts

    Re: ManyManyDataObjectManager not grabbing the Title correctly Link to this post

    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.

  • Hubertus
    Avatar
    Community Member
    14 Posts

    Re: ManyManyDataObjectManager not grabbing the Title correctly Link to this post

    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!

  • UncleCheese
    Avatar
    4085 Posts

    Re: ManyManyDataObjectManager not grabbing the Title correctly Link to this post

    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.

  • Hubertus
    Avatar
    Community Member
    14 Posts

    Re: ManyManyDataObjectManager not grabbing the Title correctly Link to this post

    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!

  • UncleCheese
    Avatar
    4085 Posts

    Re: ManyManyDataObjectManager not grabbing the Title correctly Link to this post

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

  • Hubertus
    Avatar
    Community Member
    14 Posts

    Re: ManyManyDataObjectManager not grabbing the Title correctly Link to this post

    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!

    1521 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.