Jump to:

22977 Posts in 11757 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » ImageGallery: Bad Class to Singleton

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 806 Views
  • ssssteve
    Avatar
    Community Member
    4 Posts

    ImageGallery: Bad Class to Singleton Link to this post

    Hi,

    Just added dataobjectmanager and imagegallery to my development site, and I'm getting an error

    "ERROR [User Error]: Bad class to singleton() - ImageGalleryPage

    Uploaded dataobjectmanager, did a dev/build/ and flush - no problems. Uploaded imagegallery, dev/build/ and flush, still OK. Created an ImageGalleryPage which was created, but navigating to it gives a blank error message window, sometimes accompanied by the following trace:

    ERROR [User Error]: Bad class to singleton() - ImageGalleryPage
    IN POST /silverstripe/admin/getitem?ID=34&ajax=1
    Line 328 in /**(deleted)**/silverstripe/sapphire/core/Core.php

    Source
    ======
    319: *
    320: * @param string $className
    321: * @return Object
    322: */
    323: function singleton($className) {
    324:    global $_SINGLETONS;
    325:    if(!isset($className)) user_error("singleton() Called without a class", E_USER_ERROR);
    326:    if(!is_string($className)) user_error("singleton() passed bad class_name: " .
    var_export($className,true), E_USER_ERROR);
    327:    if(!isset($_SINGLETONS[$className])) {
    * 328:     if(!class_exists($className)) user_error("Bad class to singleton() - $className",
    E_USER_ERROR);
    329:       $_SINGLETONS[$className] = Object::strong_create($className,null, true);
    330:       if(!$_SINGLETONS[$className]) user_error("singleton() Unknown class '$className'", E_USER_ERROR);
    331:    }
    332:    return $_SINGLETONS[$className];
    333: }
    334:

    Trace
    =====
    <ul>user_error(Bad class to singleton() - ImageGalleryPage,256)
    line 328 of Core.php

    singleton(ImageGalleryPage)
    line 312 of SiteTree.php

    SiteTree::page_type_classes()
    line 2204 of SiteTree.php

    SiteTree->getClassDropdown()
    line 1754 of SiteTree.php

    SiteTree->getCMSFields(CMSMain)
    line 438 of CMSMain.php

    CMSMain->getEditForm(34)
    line 1023 of LeftAndMain.php

    LeftAndMain->EditForm()
    line 384 of LeftAndMain.php

    LeftAndMain->getitem(SS_HTTPRequest)
    line 193 of Controller.php

    Controller->handleAction(SS_HTTPRequest)
    line 134 of RequestHandler.php

    RequestHandler->handleRequest(SS_HTTPRequest)
    line 147 of Controller.php

    Controller->handleRequest(SS_HTTPRequest)
    line 283 of Director.php

    Director::handleRequest(SS_HTTPRequest,Session)
    line 127 of Director.php

    Director::direct(/admin/getitem)
    line 127 of main.php

    </ul>

    It won't let me delete the page until I uninstall imagegallery, but after a reinstall it repeats the above. Help!

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