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.

Data Model Questions /

what is getviewer?


Reply


2 Posts   1346 Views

Avatar
DsX

Community Member, 178 Posts

18 December 2010 at 12:34pm

I am getting a getviewer error after moving some of my pages one level deeper the site tree.

I have had to change some code from using director::param() to using Controller::curr()->urlParams due to the params being uncorrectly read once being nested one level lower, but this code now seems fine.. I am note sure where this error is coming from.
It might be worth noting that ImageResource extends dataobject, and that this view was being rendered with the template for 'gallery1' before. 'gallery1' is a GalleryPage which extends Page, 'Galleries' and 'fashion' are galleryHolders. The new level added is 'fashion'

Here is the actual error.
I am hoping by getting a better understanding of getviewer I can work this out.

[User Error] Uncaught Exception: Object->__call(): the method 'getviewer' does not exist on 'ImageResource'
GET /galleries/fashion/gallery1/Display/1

Line 724 in C:\xampp\htdocs\vhost\mysite\httpdocs\sapphire\core\Object.php
Source

715             
716             default :
717                throw new Exception (
718                   "Object->__call(): extra method $method is invalid on $this->class:" . var_export($config, true)
719                );
720          }
721       } else {
722          // Please do not change the exception code number below.
723          
724          throw new Exception("Object->__call(): the method '$method' does not exist on '$this->class'", 2175);
725       }
726    }
727    
728    // -----------------------------------------------------------------------------------------------------------------
729    
730    /**

Trace

* Object->__call(getViewer,Array)
* ImageResource->getViewer(Display)
Line 155 of Controller.php
* Controller->handleRequest(SS_HTTPRequest)
Line 199 of ContentController.php
* ContentController->handleRequest(SS_HTTPRequest)
Line 184 of ContentController.php
* ContentController->handleRequest(SS_HTTPRequest)
Line 184 of ContentController.php
* ContentController->handleRequest(SS_HTTPRequest)
Line 67 of ModelAsController.php
* ModelAsController->handleRequest(SS_HTTPRequest)
Line 281 of Director.php
* Director::handleRequest(SS_HTTPRequest,Session)
Line 124 of Director.php
* Director::direct(/galleries/fashion/gallery1/Display/1)
Line 127 of main.php

Appreciate any insight you might have.

Avatar
DsX

Community Member, 178 Posts

20 December 2010 at 9:54am

OK, I solved my question (sort of, still would love to understand getviewer better).
My problem was related to my template methods call. The context of the call was incorrect.
After some restructuring I was able to move the call outside of a control that had a 'ImageResource' context.