Jump to:

7911 Posts in 1354 Topics by 930 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Preview: DataObjectManager module

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w

Go to End
Author Topic: 54213 Views
  • Taffy
    Avatar
    Community Member
    119 Posts

    Re: Preview: DataObjectManager module Link to this post

    Not sure if this has been posted but here is the link to the module on the unsuported modules page http://silverstripe.org/dataobjectmanager-module/

  • hu
    Avatar
    Community Member
    21 Posts

    Re: Preview: DataObjectManager module Link to this post

    There is a "small bug" behind the links on page navigation for lists. The parameters of First, Next, Previous an Last are twice in parameter string.

    admin/EditForm/field/Products?ctf[Products][per_page]=10&ctf[Products][showall]=0&ctf[Products][sort]=SortOrder&ctf[Products][sort_dir]=DESC&ctf[Products][search]=&ctf[Products][filter]=&ctf[Products][start]=10&ctf[Products][per_page]=10&ctf[Products][showall]=0&ctf[Products][sort]=SortOrder&ctf[Products][sort_dir]=DESC&ctf[Products][search]=&ctf[Products][filter]=

  • UncleCheese
    Avatar
    4085 Posts

    Re: Preview: DataObjectManager module Link to this post

    Hey! Look at that! It got posted. Finally. Still waiting for the ImageGallery to get some love.

    @hu - Thanks for the heads up. I'll look at that.

  • Ben Gribaudo
    Avatar
    Community Member
    181 Posts

    Re: Preview: DataObjectManager module Link to this post

    Uncle Cheese,

    I think I'm missing something. I'm setting setParentClass('Page') on the FileDataObjectManager instance, yet PDFResource's PageID column stays set at 0. Any clues?

    Ben

  • UncleCheese
    Avatar
    4085 Posts

    Re: Preview: DataObjectManager module Link to this post

    Can you show me QualityChildPage?

  • Ben Gribaudo
    Avatar
    Community Member
    181 Posts

    Re: Preview: DataObjectManager module Link to this post

    Sure thing.

    class QualityChildPage extends Page {
       static $db = array('Category' => "Enum('Links, Workplace, Family, Stories, Extras','Links')");
       static $default_parent = 'QualityHomePage';
       static $can_be_root = false;
       static $allowed_children = array();
       static $icon = "themes/memberscf/images/pageicons/cqarticle";

       function getCMSFields() {
          $fields = parent::getCMSFields();

          $fields->addFieldToTab('Root.Content.Metadata', new DropdownField('Category', 'Category', singleton('QualityChildPage')->dbObject('Category')->enumValues()));
          return $fields;
       }
       
       function Quality() {
          return $this->Parent()->Quality;
       }
    }

    class QualityChildPage_Controller extends Page_Controller {
       protected $sidebar = 'QualitySideBar';

    public function CategoryLinks($category) {
    return QualityHelper::CategoryLinks($category, $this->Parent());
    }
    }

    class QualityHelper {
       public static function CategoryLinks($category, $quality) {
    $results = new DataObjectSet();
    foreach($quality->Children() as $child) {
    if ($child->Category != $category) continue;
    $results->push($child);
    }

    return $results;
    }
    }

  • robinp
    Avatar
    Community Member
    33 Posts

    Re: Preview: DataObjectManager module Link to this post

    Hi,

    I was justing try to use the setPageSize() method and it doesn't seem to be working. I can get to it work by changing the line

    protected $per_page = "5";

    Cheers

    Robin

  • UncleCheese
    Avatar
    4085 Posts

    Re: Preview: DataObjectManager module Link to this post

    That's because the page size is set in the UI in the bottom right. By changing the property per_page, you're setting the default value to that dropdown.

    54213 Views
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.