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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

All other Modules /

Discuss all other Modules here.

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

Rating Module


Go to End


2 Posts   1674 Views

Avatar
lanks

Community Member, 61 Posts

25 January 2010 at 1:14pm

I am trying to get the rating module to work. When clicking the rate button to rate the website is crashing with this error:

[User Error] Uncaught Exception: Object->__call(): the method 'data' does not exist on 'RatingControllerDecorator'
POST /test232/sample-blog-entry/RatingForm

Line 515 in /var/www/test232/sapphire/core/Object.php
Source

506 				case isset($config['function']) :
507 					return $config['function']($this, $arguments);
508 				
509 				default :
510 					throw new Exception (
511 						"Object->__call(): extra method $method is invalid on $this->class:" . var_export($config, true)
512 					);
513 			}
514 		} else {
515 			throw new Exception("Object->__call(): the method '$method' does not exist on '$this->class'");
516 		}
517 	}
518 	
519 	// -----------------------------------------------------------------------------------------------------------------
520 	
521 	/**

Trace

    * Object->__call(data,Array)
    * RatingControllerDecorator->data()
      Line 39 of RatingControllerDecorator.php
    * RatingControllerDecorator->Rate(Array,Form,HTTPRequest)
    * call_user_func_array(Array,Array)
      Line 489 of Object.php
    * Object->__call(Rate,Array)
    * BlogEntry_Controller->Rate(Array,Form,HTTPRequest)
      Line 241 of Form.php
    * Form->httpSubmission(HTTPRequest)
      Line 129 of RequestHandler.php
    * RequestHandler->handleRequest(HTTPRequest)
      Line 143 of RequestHandler.php
    * RequestHandler->handleRequest(HTTPRequest)
      Line 122 of Controller.php
    * Controller->handleRequest(HTTPRequest)
      Line 29 of ModelAsController.php
    * ModelAsController->handleRequest(HTTPRequest)
      Line 277 of Director.php
    * Director::handleRequest(HTTPRequest,Session)
      Line 121 of Director.php
    * Director::direct(/sample-blog-entry/RatingForm)
      Line 118 of main.php

It is crashing on this line of code trying to call a method "data()" that doesn't seem to exist. So I am not too sure if this is a method or if its a mistake and is meant to be a different method:

$this->data()->Rate((int)$data['Rating'], $this->owner->getRequest()->getIP());

If anyone has any ideas as to what it's trying to do that would be great. I think it's possible this method could have been taken out as I believe this module hasn't been updated for some time.

Avatar
lanks

Community Member, 61 Posts

30 January 2010 at 4:52pm

Heres the whole function and the link to the module if anyone can help.

 function Rate($data) {
                $this->data()->Rate((int)$data['Rating'], $this->owner->getRequest()->getIP());

                if (Director::is_ajax()){
                        FormResponse::add('Application updated', 'good');
                        return FormResponse::respond();
                }
                else {
                        Director::redirectBack();
                }
        }

Link to download: http://open.silverstripe.com/changeset/latest/modules/rating/trunk?old_path=/&filename=/modules/rating/trunk&format=zip