17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 2218 Views |
-
Bad class to singleton error when extending PageComment class

11 December 2008 at 5:14am
I'm trying to add a couple of extra DB fields to page comments, but I've got totally stuck with the error from the title. Code in questions is:
class OurPageComment extends PageComment {
static $db = array(
"Company" => "Varchar(100)",
"Email" => "Varchar(255)",
"Homepage" => "Varchar(255)",
);
}As you can see I've just tried extending PageComment the same way it's done with other classes in tutorials/docs, but it obviously can't be done that way.
Error trace (when I go to /db/build/..):
* Bad class to singleton() - OurPageComment
Line 263 of Core.php
* singleton(OurPageComment)
Line 161 of DatabaseAdmin.php
* DatabaseAdmin->doBuild()
Line 81 of DatabaseAdmin.php
* DatabaseAdmin->build(HTTPRequest)
Line 162 of Controller.php
* Controller->handleAction(HTTPRequest)
Line 107 of RequestHandler.php
* RequestHandler->handleRequest(HTTPRequest)
Line 122 of Controller.php
* Controller->handleRequest(HTTPRequest)
Line 257 of Director.php
* Director::handleRequest(HTTPRequest,Session)
Line 106 of Director.php
* Director::direct(db/build)
Line 111 of main.php -
Re: Bad class to singleton error when extending PageComment class

11 December 2008 at 7:18am
Ok, I managed to solve the problem, the class that extends PageComment has to be in a separate file. I had it defined in the same file where my page class is defined and SS couldn't find it there obviously.
| 2218 Views | ||
|
Page:
1
|
Go to Top |

