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.

DataObjectManager Module

Discuss the DataObjectManager module, and the related ImageGallery module.

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

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


Reply

32 Posts   5315 Views

Avatar
R0yk3

25 September 2009 at 8:25pm Community Member, 20 Posts

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.

Avatar
NickJacobs

29 September 2009 at 10:23pm Community Member, 144 Posts

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.

Avatar
UncleCheese

30 September 2009 at 5:21am 4085 Posts

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

Avatar
R0yk3

30 September 2009 at 10:37pm Community Member, 20 Posts

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

Avatar
R0yk3

30 September 2009 at 10:39pm Community Member, 20 Posts

Then again the file has moved??

Avatar
R0yk3

30 September 2009 at 10:53pm Community Member, 20 Posts

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.

Avatar
wmk

28 October 2009 at 4:37am Community Member, 45 Posts

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

Avatar
UncleCheese

28 October 2009 at 4:41am 4085 Posts

Perfect. Thanks for that fix!