Jump to:

7939 Posts in 1472 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » [User Error] Uncaught Exception: Object->__call(): the method 'backlinktracking' does not exist on 'ImageGalleryImage'

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1 2 3 4
Go to End
Author Topic: 4835 Views
  • R0yk3
    Avatar
    Community Member
    20 Posts

    Re: [User Error] Uncaught Exception: Object->__call(): the method 'backlinktracking' does not exist on 'ImageGalleryImage' Link to this post

    Uncle Cheese,

    Thank you for your time but i removed SilverStripe from my server.
    I was just trying out some things. A gallery was priority, and the CMS secondary.
    Since the gallery is giving me troubles (maybe it has something to do with open_basedir) But i had a working gallery and take the easy road for now.

    Again thank you.

  • NickJacobs
    Avatar
    Community Member
    144 Posts

    Re: [User Error] Uncaught Exception: Object->__call(): the method 'backlinktracking' does not exist on 'ImageGalleryImage' Link to this post

    Yeah, I get this every time on the latest site I've set up. I have all the latest SVN's along with the 2.3.3 download.

    It happens when trying to import images into the Image Gallery from other folders (that I have bulk uploaded). I have been to Files & Images to sync files......I've tried deleting and re-uploading everything...it's doin my head in !

    Any ideas would be much appreciated.

  • UncleCheese
    Avatar
    4085 Posts

    Re: [User Error] Uncaught Exception: Object->__call(): the method 'backlinktracking' does not exist on 'ImageGalleryImage' Link to this post

    After hours of testing and banging my head, I think I've finally figured out the issue.

    For those who are curious, the problem was that the import form would retrieve each File object by id (as passed in the checkboxes on the import form) and then set its ClassName property to whatever your file class for that object is. In the case of ImageGallery, most of the time, it's ImageGalleryImage. After updating the ClassName property to ImageGalleryImage, the function runs the write() method on the file object. That's where it errors out.

    What I found out was that the wildcard method __call() was reporting the current object as ImageGalleryImage, but a get_class($file) showed that it was still an Image object. That is, updating the ClassName property, while good enough for Silverstripe, is certainly not good enough for PHP. The two were out of sync. Silverstripe was trying to handle the object like an ImageGalleryImage, but to PHP, it was still the same thing it got out of the database, regardless of its ClassName property.

    The solution we owe to the geniuses at Silverstripe who never fail to amaze me in their provision of useful methods that go largely unrecognized.

    $image = $file->newClassInstance($this->fileClassName);
    $image->write();

    Thanks for all your testing and patience, guys. Please have a crack at the latest rev and let me know your findings (fingers crossed).

  • R0yk3
    Avatar
    Community Member
    20 Posts

    Re: [User Error] Uncaught Exception: Object->__call(): the method 'backlinktracking' does not exist on 'ImageGalleryImage' Link to this post

    Hi UC,

    your reply made me hopefull, so i installed again.
    SS 2.3.3
    and swf, DOM,and image gallery from svn (today 30-9-09)

    Without image gallery installed i get a error.

    [Warning] ViewableData_Customised::obj() 'DetailForm' was requested from the array data as an object but it's not an object. I can't cast it.
    POST /SilverStripe/admin/assets/EditForm/field/Files/ImportForm?ctf[Files][start]=0&ctf[Files][per_page]=10&ctf[Files][showall]=0&ctf[Files][sort]=SortOrder&ctf[Files][sort_dir]=DESC&ctf[Files][search]=&ctf[Files][filter]=&ctf[Files][view]=

    Line 990 in /var/www/clients/client1/web1/web/SilverStripe/sapphire/core/ViewableData.php
    Source

    981          return $val;
    982       } else {
    983          return $this->obj->XML_val($fieldName, $args, $cache);
    984       }
    985    }
    986    
    987    function obj($fieldName, $args = null, $forceReturnObject = false) {
    988       if(isset($this->extraData[$fieldName])) {
    989          if(!is_object($this->extraData[$fieldName])) {
    990             user_error("ViewableData_Customised::obj() '$fieldName' was requested from the array data as an object but it's not an object. I can't cast it.", E_USER_WARNING);
    991          }
    992          return $this->extraData[$fieldName];
    993       } else {
    994          return $this->obj->obj($fieldName, $args, $forceReturnObject);
    995       }
    996    }

    Trace

    * ViewableData_Customised::obj() 'DetailForm' was requested from the array data as an object but it's not an object. I can't cast it.
    Line 990 of ViewableData.php
    * ViewableData_Customised->obj(DetailForm,,1)
    Line 35 of .cache.var.www.clients.client1.web1.web.SilverStripe.dataobject_manager.templates.DataObjectManager_popup.ss
    * include(/var/www/clients/client1/web1/web/SilverStripe/silverstripe-cache/.cache.var.www.clients.client1.web1.web.SilverStripe.dataobject_manager.templates.DataObjectManager_popup.ss)
    Line 354 of SSViewer.php
    * SSViewer->process(ViewableData_Customised)
    Line 773 of ViewableData.php
    * ViewableData->renderWith(DataObjectManager_popup)
    Line 535 of FileDataObjectManager.php
    * FileDataObjectManager->saveImportForm(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 143 of RequestHandler.php
    * RequestHandler->handleRequest(HTTPRequest)
    Line 143 of RequestHandler.php
    * RequestHandler->handleRequest(HTTPRequest)
    Line 122 of Controller.php
    * Controller->handleRequest(HTTPRequest)
    Line 277 of Director.php
    * Director::handleRequest(HTTPRequest,Session)
    Line 121 of Director.php
    * Director::direct(/admin/assets/EditForm/field/Files/ImportForm)
    Line 118 of main.php

    it is another error.

    When did i get this error.
    In the tab files and images.
    i created a new folder called tmp (under Uploads)
    i tried to move the silverstripe logo from Uploads to tmp
    then i get above error.

    Kind regards

  • R0yk3
    Avatar
    Community Member
    20 Posts
  • R0yk3
    Avatar
    Community Member
    20 Posts

    Re: [User Error] Uncaught Exception: Object->__call(): the method 'backlinktracking' does not exist on 'ImageGalleryImage' Link to this post

    Importing from local disk to the image gallery works now. So the moving from the folder Uploads to a image gallery folder Works! After uploading my page gets al screwed up but after a relaod (F5) i have a normal screen again.

    i mailed some credentials to you so you can login and see it for yourself.

  • wmk
    Avatar
    Community Member
    44 Posts

    Re: [User Error] Uncaught Exception: Object->__call(): the method 'backlinktracking' does not exist on 'ImageGalleryImage' Link to this post

    Hey Uncle Cheese,

    could you please provide this patch also to FileDataObjectManager ?

    I had the same problem linking some GalleryPics to an article (little homebrew gallery stuff), adding

    $file = $file->newClassInstance($this->fileClassName);


    right after

    if($this->fileClassName != "File" && $file->ClassName != $this->fileClassName) {


    in line 521 (saveImportForm()) did the trick...

    cheers,

    wmk

  • UncleCheese
    Avatar
    4085 Posts
    4835 Views
Page: 1 2 3 4
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.