Jump to:

22978 Posts in 11495 Topics by 2825 members

General Questions

SilverStripe Forums » General Questions » Tutorials seem broken

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 2
Go to End
Author Topic: 2043 Views
  • one_life
    Avatar
    Community Member
    8 Posts

    Re: Tutorials seem broken Link to this post

    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

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: Tutorials seem broken Link to this post

    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.

  • one_life
    Avatar
    Community Member
    8 Posts

    Re: Tutorials seem broken Link to this post

    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',
       );
    }
    ?>

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: Tutorials seem broken Link to this post

    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.

  • one_life
    Avatar
    Community Member
    8 Posts

    Re: Tutorials seem broken Link to this post

    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.

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