Jump to:

3460 Posts in 1064 Topics by 739 members

Data Model Questions

SilverStripe Forums » Data Model Questions » what is getviewer?

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

Page: 1
Go to End
Author Topic: 1307 Views
  • DsX
    Avatar
    Community Member
    178 Posts

    what is getviewer? Link to this post

    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.

  • DsX
    Avatar
    Community Member
    178 Posts

    Re: what is getviewer? Link to this post

    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.

    1307 Views
Page: 1
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.