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.

All other Modules /

Discuss all other Modules here.

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

Event Calendar + SS2.3.2 rc1 - PROBLEMS


Go to End
Reply


10 Posts   3559 Views

Avatar
SalvaStripe

Community Member, 89 Posts

25 May 2009 at 11:39pm

Edited: 25/05/2009 11:42pm

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`?

Avatar
UncleCheese

Forum Moderator, 4096 Posts

26 May 2009 at 3:54am

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?

Avatar
SalvaStripe

Community Member, 89 Posts

26 May 2009 at 7:14pm

in _config.php there is already this line:

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

Avatar
SalvaStripe

Community Member, 89 Posts

26 May 2009 at 10:09pm

Edited: 26/05/2009 10:20pm

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 :D

Avatar
UncleCheese

Forum Moderator, 4096 Posts

27 May 2009 at 3:29pm

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

Avatar
SalvaStripe

Community Member, 89 Posts

28 May 2009 at 8:15pm

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
;)

Avatar
UncleCheese

Forum Moderator, 4096 Posts

29 May 2009 at 1:47am

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.

Avatar
SalvaStripe

Community Member, 89 Posts

2 June 2009 at 7:49pm

"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!

Go to Top