Jump to:

7940 Posts in 1543 Topics by 946 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Bad RecordClassName '' and $baseClass not set Error

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1 2
Go to End
Author Topic: 3706 Views
  • Fairfax71
    Avatar
    Community Member
    13 Posts

    Re: Bad RecordClassName '' and $baseClass not set Error Link to this post

    Yes, as I said in my first post, no empty ClassName fields in the File table that I can see.

  • Fairfax71
    Avatar
    Community Member
    13 Posts

    Re: Bad RecordClassName '' and $baseClass not set Error Link to this post

    Here is the SQL dump, just to demonstrate:

    INSERT INTO `File` (`ID`, `ClassName`, `Created`, `LastEdited`, `Name`, `Title`, `Filename`, `Content`, `Sort`, `ParentID`, `OwnerID`, `SortOrder`) VALUES
    (1, 'Folder', '2010-05-05 14:29:22', '2010-05-05 14:29:22', 'Uploads', 'Uploads', 'assets/Uploads/', NULL, 0, 0, 0, 0),
    (2, 'Image', '2010-05-05 14:29:22', '2010-05-05 14:29:22', 'SilverStripeLogo.png', 'SilverStripeLogo.png', 'assets/Uploads/SilverStripeLogo.png', NULL, 0, 1, 0, 0),
    (3, 'File', '2010-05-07 15:43:39', '2010-05-07 15:43:39', 'error-404.html', 'error-404.html', 'assets/error-404.html', NULL, 0, 0, 1, 0),
    (4, 'Folder', '2010-05-07 15:43:39', '2010-05-07 15:43:39', 'images', 'images', 'assets/images/', NULL, 0, 0, 1, 0),
    (5, 'Image', '2010-05-07 15:43:39', '2010-05-07 15:43:39', 'hippolytus.png', 'hippolytus.png', 'assets/images/hippolytus.png', NULL, 0, 4, 1, 0),
    (6, 'Image', '2010-05-07 15:43:39', '2010-05-07 15:43:39', 'image001.jpg', 'image001.jpg', 'assets/images/image001.jpg', NULL, 0, 4, 1, 0),
    (7, 'Image', '2010-05-07 15:43:39', '2010-05-07 15:43:39', 'image002.jpg', 'image002.jpg', 'assets/images/image002.jpg', NULL, 0, 4, 1, 0),
    (8, 'Image', '2010-05-07 15:43:39', '2010-05-07 15:43:39', 'image003.jpg', 'image003.jpg', 'assets/images/image003.jpg', NULL, 0, 4, 1, 0),
    (9, 'Image', '2010-05-07 15:43:39', '2010-05-07 15:43:39', 'image004.jpg', 'image004.jpg', 'assets/images/image004.jpg', NULL, 0, 4, 1, 0),
    (10, 'Image', '2010-05-07 15:43:39', '2010-05-07 15:43:39', 'image005.jpg', 'image005.jpg', 'assets/images/image005.jpg', NULL, 0, 4, 1, 0),
    (11, 'Image', '2010-05-07 15:43:39', '2010-05-07 15:43:39', 'image006.jpg', 'image006.jpg', 'assets/images/image006.jpg', NULL, 0, 4, 1, 0),
    (12, 'Image', '2010-05-07 15:43:39', '2010-05-07 15:43:39', 'image007.jpg', 'image007.jpg', 'assets/images/image007.jpg', NULL, 0, 4, 1, 0),
    (13, 'Image', '2010-05-07 15:43:39', '2010-05-07 15:43:39', 'image008.jpg', 'image008.jpg', 'assets/images/image008.jpg', NULL, 0, 4, 1, 0),
    (14, 'Image', '2010-05-07 15:43:39', '2010-05-07 15:43:39', 'synodalstruktur-lg.jpg', 'synodalstruktur-lg.jpg', 'assets/images/synodalstruktur-lg.jpg', NULL, 0, 4, 1, 0),
    (15, 'Image', '2010-05-07 15:43:39', '2010-05-07 15:43:39', 'synodalstruktur-sm-2.jpg', 'synodalstruktur-sm-2.jpg', 'assets/images/synodalstruktur-sm-2.jpg', NULL, 0, 4, 1, 0),
    (16, 'Image', '2010-05-07 15:43:39', '2010-05-07 15:43:39', 'synodalstruktur-sm.jpg', 'synodalstruktur-sm.jpg', 'assets/images/synodalstruktur-sm.jpg', NULL, 0, 4, 1, 0),
    (17, 'Folder', '2010-05-07 15:43:39', '2010-05-07 15:43:39', 'site-images', 'site-images', 'assets/site-images/', NULL, 0, 0, 1, 0);

  • Fairfax71
    Avatar
    Community Member
    13 Posts

    Re: Bad RecordClassName '' and $baseClass not set Error Link to this post

    Just as an experiment, I tried installing v2.4.0 from scratch on another server, and it worked fine. Then I added blog v0.3.0, and got all sorts of errors. When trying to log onto the CMS, I briefly see a page full of PHP errors (but too fast for me to read), then it goes back to the login window.

    When I remove the blog and run /dev/build?flush=1 again, the CMS returns to normal. Looks like the blog module isn't compatible with v2.4.0?!

    Also, if I set i18n::set_locale() to anything other than 'en_US', such as 'de_DE' for German, I get all kinds of errors as well.

    Thanks for any help in advance!

  • OCO Pure
    Avatar
    Community Member
    14 Posts

    Re: Bad RecordClassName '' and $baseClass not set Error Link to this post

    I am experiencing the same problems in combination with the ecommerce module (most current build from the trunk). Here`s my trace:

    [User Error] Bad RecordClassName '' and $baseClass not set
    GET /admin

    Line 2705 in /var/www/vhosts/xxx.net/httpdocs/sapphire/core/model/DataObject.php
    Source

    2696       foreach($records as $record) {
    2697          if(empty($record['RecordClassName'])) {
    2698             $record['RecordClassName'] = $record['ClassName'];
    2699          }
    2700          if(class_exists($record['RecordClassName'])) {
    2701             $results[] = new $record['RecordClassName']($record);
    2702          } else {
    2703             if(!$baseClass) {
    2704                user_error("Bad RecordClassName '{$record['RecordClassName']}' and "
    2705                   . "\$baseClass not set", E_USER_ERROR);
    2706             } else if(!is_string($baseClass) || !class_exists($baseClass)) {
    2707                user_error("Bad RecordClassName '{$record['RecordClassName']}' and bad "
    2708                   . "\$baseClass '$baseClass not set", E_USER_ERROR);
    2709             }
    2710             $results[] = new $baseClass($record);
    2711          }

    Trace

    * Bad RecordClassName '' and $baseClass not set
    Line 2705 of DataObject.php
    * DataObject->buildDataObjectSet(MySQLQuery)
    Line 569 of Hierarchy.php
    * Hierarchy->liveChildren(1,1)
    * call_user_func_array(Array,Array)
    Line 693 of Object.php
    * Object->__call(liveChildren,Array)
    * SiteTree->liveChildren(1,1)
    Line 438 of Hierarchy.php
    * Hierarchy->doAllChildrenIncludingDeleted(CMSMain)
    Line 416 of Hierarchy.php
    * Hierarchy->AllChildrenIncludingDeleted(CMSMain)
    * call_user_func_array(Array,Array)
    Line 693 of Object.php
    * Object->__call(AllChildrenIncludingDeleted,Array)
    * SiteTree->AllChildrenIncludingDeleted(CMSMain)
    Line 159 of Hierarchy.php
    * Hierarchy->markChildren(SiteTree,CMSMain,AllChildrenIncludingDeleted,numChildren)
    Line 94 of Hierarchy.php
    * Hierarchy->markPartialTree(30,CMSMain,AllChildrenIncludingDeleted,numChildren)
    * call_user_func_array(Array,Array)
    Line 693 of Object.php
    * Object->__call(markPartialTree,Array)
    * SiteTree->markPartialTree(30,CMSMain,AllChildrenIncludingDeleted,numChildren)
    Line 516 of LeftAndMain.php
    * LeftAndMain->getSiteTreeFor(SiteTree)
    Line 168 of CMSMain.php
    * CMSMain->SiteTreeAsUL()
    Line 369 of ViewableData.php
    * ViewableData->obj(SiteTreeAsUL,,,1)
    Line 445 of ViewableData.php
    * ViewableData->XML_val(SiteTreeAsUL,,1)
    Line 322 of .cache.var.www.vhosts.xxx.net.httpdocs.cms.templates.Includes.CMSMain_left.ss
    * include(/var/www/vhosts/xxx.net/httpdocs/silverstripe-cache/.cache.var.www.vhosts.xxx.net.httpdocs.cms.templates.Includes.CMSMain_left.ss)
    Line 392 of SSViewer.php
    * SSViewer->process(CMSMain)
    Line 342 of ViewableData.php
    * ViewableData->renderWith(Array)
    Line 483 of LeftAndMain.php
    * LeftAndMain->Left()
    Line 369 of ViewableData.php
    * ViewableData->obj(Left,,,1)
    Line 445 of ViewableData.php
    * ViewableData->XML_val(Left,,1)
    Line 59 of .cache.var.www.vhosts.xxx.net.httpdocs.cms.templates.LeftAndMain.ss
    * include(/var/www/vhosts/xxx.net/httpdocs/silverstripe-cache/.cache.var.www.vhosts.xxx.net.httpdocs.cms.templates.LeftAndMain.ss)
    Line 392 of SSViewer.php
    * SSViewer->process(CMSMain)
    Line 202 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)
    Line 127 of main.php

    I have already filled the 2 empty fields in the File table of the DB, but this is not changing anything.

  • Fairfax71
    Avatar
    Community Member
    13 Posts

    Re: Bad RecordClassName '' and $baseClass not set Error Link to this post

    The only "solution" I have found so far is to reinstall from scratch with 2.4.x, make sure the extensions are all compatible with 2.4 and install them, and repopulate the database with the content. Clearly there is something in the DB causing all the trouble, but I'll be hanged if I can find it.

  • OCO Pure
    Avatar
    Community Member
    14 Posts

    Re: Bad RecordClassName '' and $baseClass not set Error Link to this post

    Ah, forget to mention that - I have already done this 2 times last weekend. Either the ecommerce module is working correctly, or the admin area is accessable. But I haven`t get to the point where these 2 states are available the same time.

  • emp4180
    Avatar
    Community Member
    5 Posts

    Re: Bad RecordClassName '' and $baseClass not set Error Link to this post

    To solve this, you can manipulate data directly on the database so you can avoid reinstalling stuff.

    //Check pages with no classnames
    1. Select count(*) from SiteTree where ClassName = '';

    //Fix
    2. Update SiteTree set ClassName='Page' where ClassName ='';

    If versioned, try:
    Update SiteTree_Live set ClassName='Page' where ClassName ='';

    This problem happens when you remove or rename a class. And then when you do a dev/build, pages with that renamed classname will be updated or set to blank as shown in the queries above.

    This thread is old but I have to put this here just for reference.

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