Jump to:

7912 Posts in 1355 Topics by 930 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Bug Reports

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
Go to End
Author Topic: 37702 Views
  • Martijn
    Avatar
    Community Member
    270 Posts

    Re: Bug Reports Link to this post

    When changing the Gallery name the Folder Title always stays NewImageGalleryPage, so when people browse images from the TinyMCE image button, they see x times NewImageGalleryPage.

    Fix :

    ImageGalleryPage.php

    add:

    function onBeforeWrite() {
          parent::onBeforeWrite();
          if( $this->ID )
             $this->RootFolder()->Title = $this->Title;
    // or $this->MenuTitle?      
       }

  • Anonymous user
    Avatar
    Community Member
    1 Post

    Re: Bug Reports Link to this post

    With PHP 5.3.0, it's not possible to check for objects using get_class(), since it already expects the argument to be an object. Using is_object() solves a number of issues.

  • UncleCheese
    Avatar
    4085 Posts

    Re: Bug Reports Link to this post

    Is there a specific block of code you're referring to?

  • Anonymous user
    Avatar
    Community Member
    1 Post

    Re: Bug Reports Link to this post

    Yes, sorry for being lazy, I am rushing through a number of projects here

    Here is a diff:

    Index: code/HasManyFileDataObjectManager.php
    ===================================================================
    --- code/HasManyFileDataObjectManager.php   (Revision 252)
    +++ code/HasManyFileDataObjectManager.php   (Arbeitskopie)
    @@ -95,7 +95,7 @@
          $records = $dataQuery->execute();
          $items = new DataObjectSet();
          foreach($records as $record) {
    -         if(! get_class($record)) {
    +         if(! is_object($record)) {
                $class = $this->sourceClass;
                $record = new $class($record);
             }
    @@ -106,7 +106,7 @@
          $records = $dataQuery->execute();
          $unpagedItems = new DataObjectSet();
          foreach($records as $record) {
    -         if(! get_class($record))
    +         if(! is_object($record))
                $record = new DataObject($record);
             $unpagedItems->push($record);
          }
    Index: code/HasManyDataObjectManager.php
    ===================================================================
    --- code/HasManyDataObjectManager.php   (Revision 252)
    +++ code/HasManyDataObjectManager.php   (Arbeitskopie)
    @@ -91,7 +91,7 @@
          $records = $dataQuery->execute();
          $items = new DataObjectSet();
          foreach($records as $record) {
    -         if(! get_class($record))
    +         if(! is_object($record))
                $class = $this->sourceClass;
                $record = new $class($record);
             $items->push($record);
    @@ -101,7 +101,7 @@
          $records = $dataQuery->execute();
          $unpagedItems = new DataObjectSet();
          foreach($records as $record) {
    -         if(! get_class($record)) {
    +         if(! is_object($record)) {
                $class = $this->sourceClass;
                $record = new $class($record);
             }

  • UncleCheese
    Avatar
    4085 Posts

    Re: Bug Reports Link to this post

    All that code is lifted from HasManyComplexTableField, actually. Probably ought to submit that bug to them, too. Thanks.

  • Anonymous user
    Avatar
    Community Member
    1 Post

    Re: Bug Reports Link to this post

    Didn't they fix PHP 5.3 issues with v2.3.3 already? I'll have to check later, but afaik I am not encountering any problems with the normal CTF classes.

    Thanks to you for the quick response. Your module makes my life so much easier every day.

  • Willr
    Avatar
    Forum Moderator
    5163 Posts

    Re: Bug Reports Link to this post

    Yes notices to do with 5.3 have been fixed in 2.3.3 and trunk. The actual root cause of these notices will be fixed in 2.4 etc but they might be too intense to get into 2.3 so hence we just hide the notices.

  • UncleCheese
    Avatar
    4085 Posts

    Re: Bug Reports Link to this post

    I've checked in a version of these files using is_object instead of get_class.

    37702 Views
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
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.