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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

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

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

Tutorials seem broken


Go to End


13 Posts   3298 Views

Avatar
one_life

Community Member, 8 Posts

12 December 2009 at 2:51am

This is the error I get when I try to process the form. Thanks a million for the help.

[User Error] Uncaught ReflectionException: Class text does not exist
POST /latique/home/BrowserPollForm

Line 89 in /Applications/MAMP/htdocs/latique/sapphire/core/Object.php

Source

80 	 * @param string $class the class name
81 	 * @param mixed $arguments,... arguments to pass to the constructor
82 	 * @return Object
83 	 */
84 	public static function create() {
85 		$args  = func_get_args();
86 		$class = self::getCustomClass(array_shift($args));
87 		
88 		if(version_compare(PHP_VERSION, '5.1.3', '>=')) {
89 			$reflector = new ReflectionClass($class);
90 			return $reflector->newInstanceArgs($args);
91 		} else {
92 			// we're using a PHP install that doesn't support ReflectionClass->newInstanceArgs()
93 			
94 			$args = $args + array_fill(0, 9, null);
95 			return new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6], $args[7], $args[8]);
Trace

ReflectionClass->__construct(text) 
Line 89 of Object.php
Object::create(text,Name) 
Line 1 of DataObject.php(1920) : eval()'d code
eval 
Line 1920 of DataObject.php
DataObject->setCastedField(Name,adfa) 
Line 140 of FormField.php
FormField->saveInto(BrowserPollSubmission) 
Line 886 of Form.php
Form->saveInto(BrowserPollSubmission) 
Line 50 of HomePage.php
HomePage_Controller->doBrowserPoll(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 119 of Controller.php
Controller->handleRequest(HTTPRequest) 
Line 29 of ModelAsController.php
ModelAsController->handleRequest(HTTPRequest) 
Line 277 of Director.php
Director::handleRequest(HTTPRequest,Session) 
Line 121 of Director.php
Director::direct(/home/BrowserPollForm) 
Line 118 of main.php

Avatar
Willr

Forum Moderator, 5523 Posts

12 December 2009 at 9:37am

Object::create(text,Name)

Seems odd - Name should be a varchar object rather then a text field. In your BrowserPollSubmission.php is your name database field a varchar field.

Avatar
one_life

Community Member, 8 Posts

12 December 2009 at 9:48am

hi,

No, here is my BrowserPollSubmission class. The fields in the actual DB are both mediumtext. These were created by SS.

<?
/*
	Browser Poll Submission
*/

class BrowserPollSubmission extends DataObject{
	static $db = array(
		'Name' => 'text',
		'Browser' => 'text',
	);
}
?>

Avatar
Willr

Forum Moderator, 5523 Posts

12 December 2009 at 9:55am

I think thats your problem

      'Name' => 'text', 
      'Browser' => 'text', 

1: You should use Varchar(200) since your not going to need a whole massive Text field type for name - Text fields are more for storing up to 4mb of text

2: Datatypes / Classnames are always UpperCamelCase. So varchar => Varchar and text would be Text.

Avatar
one_life

Community Member, 8 Posts

12 December 2009 at 10:02am

Wow,

Thanks! I must have typed that class close to 10 times. each time doing the exact same thing wrong. Thanks for your help. This worked. Now I can create Forms like a mad scientist! bwahaha.

:)

Go to Top