Jump to:

10929 Posts in 2613 Topics by 1809 members

All other Modules

SilverStripe Forums » All other Modules » Event Calendar + SS2.3.2 rc1 - PROBLEMS

Discuss all other Modules here.

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

Page: 1 2
Go to End
Author Topic: 3343 Views
  • SalvaStripe
    Avatar
    Community Member
    89 Posts

    Event Calendar + SS2.3.2 rc1 - PROBLEMS Link to this post

    hey, i tried to install the event calendar module on the 2.3.2 rc1 version of silverstripe.
    after uploading and running dev/build, i get this error page:

    [User Error] DataObjectDecorator->setOwner(): Trying to decorate an object of class 'CMSMain' with 'CalendarScriptInit', only Dataobject subclasses are supported.
    GET /admin/

    Line 41 in /var/www/vhosts/domain/httpdocs/sapphire/core/model/DataObjectDecorator.php
    Source

    32     * @param DataObject $owner
    33     */
    34    function setOwner(Object $owner) {
    35       if(!($owner instanceof DataObject)) {
    36          user_error(sprintf(
    37             "DataObjectDecorator->setOwner(): Trying to decorate an object of class '%s' with '%s',
    38             only Dataobject subclasses are supported.",
    39             get_class($owner), $this->class),
    40             E_USER_ERROR
    41          );
    42          return false;
    43       }
    44       
    45       parent::setOwner($owner);
    46    }
    47    

    Trace

    * DataObjectDecorator->setOwner(): Trying to decorate an object of class 'CMSMain' with 'CalendarScriptInit', only Dataobject subclasses are supported.
    Line 41 of DataObjectDecorator.php

    * DataObjectDecorator->setOwner(CMSMain)
    Line 456 of Object.php

    * Object->__construct()
    Line 74 of RequestHandler.php

    * RequestHandler->__construct()
    Line 274 of Director.php

    * Director::handleRequest(HTTPRequest,Session)
    Line 121 of Director.php

    * Director::direct(/admin/)
    Line 118 of main.php

    someone knows more about`?

  • UncleCheese
    Avatar
    4085 Posts

    Re: Event Calendar + SS2.3.2 rc1 - PROBLEMS Link to this post

    I don't have a 2.3.2 installation set up anywhere. Can you try changing in the _config.php DataObject::add_extension to Object::add_extension?

  • SalvaStripe
    Avatar
    Community Member
    89 Posts

    Re: Event Calendar + SS2.3.2 rc1 - PROBLEMS Link to this post

    in _config.php there is already this line:

    Object::add_extension('SiteTree', 'Translatable');

  • SalvaStripe
    Avatar
    Community Member
    89 Posts

    Re: Event Calendar + SS2.3.2 rc1 - PROBLEMS Link to this post

    THIS IS CODE OF DataObjectDecorator.php from 2.3.1:

       
       /**
        * Load the extra database fields defined in extraStatics.
        */

       function loadExtraStatics() {
          // Don't apply DB fields if the parent object has this extension too
          if(singleton(get_parent_class($this->owner))->extInstance($this->class)) return;
       
          $fields = $this->extraStatics();
          $className = $this->owner->class;

          if($fields) {
             foreach($fields as $relationType => $fields) {
                if(in_array($relationType, self::$decoratable_statics)) {
                   eval("$className::\$$relationType = array_merge((array){$className}::\$$relationType, (array)\$fields);");
                   $this->owner->set_stat($relationType, eval("return $className::\$$relationType;"));
                }
                
                // clear previously set caches from DataObject->hasOwnTableDatabaseField()
                $this->owner->set_uninherited('_cache_hasOwnTableDatabaseField', null);
             }
          }
       }

    AND THIS IS CODE OF DataObjectDecorator.php from 2.3.2 rc1:

          /**
        * Set the owner of this decorator.
        * @param DataObject $owner
        */

       function setOwner(Object $owner) {
          if(!($owner instanceof DataObject)) {
             user_error(sprintf(
                "DataObjectDecorator->setOwner(): Trying to decorate an object of class '%s' with '%s',
                only Dataobject subclasses are supported."
    ,
                get_class($owner), $this->class),
                E_USER_ERROR
             );
             return false;
          }
          
          parent::setOwner($owner);
       }
       
       /**
        * Load the extra database fields defined in extraStatics.
        */

       function loadExtraStatics() {
          // Don't apply DB fields if the parent object has this extension too
          if(Object::has_extension($this->owner->parentClass(), $this->class)) return;

          if($fields = $this->extraStatics()) {
             foreach($fields as $relation => $fields) {
                if(in_array($relation, self::$decoratable_statics)) {
                   // Can't use add_static_var() here as it would merge the array rather than replacing
                   Object::set_static (
                      $this->owner->class,
                      $relation,
                      array_merge((array) Object::get_static($this->owner->class, $relation), $fields)
                   );
                }
             }
             
             DataObject::$cache_has_own_table[$this->owner->class] = null;
             DataObject::$cache_has_own_table_field[$this->owner->class] = null;
          }
       }

    I cannot do something good with it :S

    ###################
    it would be sooo nice, when you silverstripe team can make a much better "code" posting.. here in forums that point is realy importand

  • UncleCheese
    Avatar
    4085 Posts

    Re: Event Calendar + SS2.3.2 rc1 - PROBLEMS Link to this post

    I've fixed this bug. Just checked it into SVN.

  • SalvaStripe
    Avatar
    Community Member
    89 Posts

    Re: Event Calendar + SS2.3.2 rc1 - PROBLEMS Link to this post

    http://bluehousegroup.svn.beanstalkapp.com/modules/trunk/event_calendar/

    do you mean in here?
    did you fixed it, that now the same version works on 2.3.1 AND 2.3.2 rc1?

    hm, can you tell me what file you fixed.. i dont want to save and replace ALL flies from there. hmm
    ;)

  • UncleCheese
    Avatar
    4085 Posts

    Re: Event Calendar + SS2.3.2 rc1 - PROBLEMS Link to this post

    If you're using SVN you don't have to replace all the files. It will just find the new ones. If you don't want to use SVN, I'll be posting a new ZIP file later today.

    But to make sure you get quick updates, you should switch over to SVN.

  • SalvaStripe
    Avatar
    Community Member
    89 Posts

    Re: Event Calendar + SS2.3.2 rc1 - PROBLEMS Link to this post

    "did you fixed it, that now the same calendar module version works on 2.3.1 AND 2.3.2 rc1?"

    oh yes please post a ZIP file with the files.

    i have no idea, what the SVN realy is or how to use it. humm.. i will read about it!

    3343 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.