Jump to:

22976 Posts in 11702 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » silverstripe book - error [RESOLVED]

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: 2020 Views
  • chinaski
    Avatar
    Community Member
    26 Posts

    silverstripe book - error [RESOLVED] Link to this post

    As the book doesn't seem to have its own forum (shame shame), I'm posting here about an error I'm receiving. I'm working through chapter 5 of the book, and am trying to add a job to one of the JobCategory pages via the ComplexTableField.

    Clicking on the add job button in the Jobs tab on the CMS admin area yields the following fatal error:

    Fatal error: Call to a member function removeByName() on a non-object in /path/to/www/sapphire/forms/ComplexTableField.php on line 521

    My JobCategory.php page looks like this:

    class JobCategory extends Page {
    static $db = array();
    static $singular_name = 'Job category';
    static $plural_name = 'Job categories';

    static $has_many = array(
    'Jobs' => 'Job'
    );

    static $many_many = array(
    'Subscribers' => 'Member'
    );

    function getCMSFields() {
    $fields = parent::getCMSFields();
    $jobsTable = new ComplexTableField($this, 'Jobs', 'Job');
    $fields->addFieldToTab('Root.Content.Jobs', $jobsTable);
    return $fields;
    }
    }

    class JobCategory_Controller extends Page_Controller {

    }


    And my Jobs.php page looks like this:

    class Job extends DataObject {
    static $db = array(
    'Title' => 'Text',
    'Description' => 'Text',
    'Location' => 'Text',
    'ExpiryDate' => 'Date'
    );
    static $singular_name = 'Job';
    static $plural_name = 'Jobs';

    static $has_one = array(
    'JobCategory' => 'JobCategory'
    );

    function getCMSFields() {
    $fields = new FieldSet(
    new TextField('Title', 'Job Title'),
    new TextareaField('Description', 'Job Description'),
    new TextField('Location', 'Location'),
    new DateField('ExpiryDate', 'Expiry Date')
    );
    return fields;
    }
    }


    Any ideas as to why I am getting this error?

  • chinaski
    Avatar
    Community Member
    26 Posts

    Re: silverstripe book - error [RESOLVED] Link to this post

    Solved by calling getCMSFields_forPopup() instead of just getCMSFields() in Jobs.php...

  • dalesaurus
    Avatar
    Community Member
    283 Posts

    Re: silverstripe book - error [RESOLVED] Link to this post

    I was just going through that chapter myself tonight, and oh the errata...

  • chinaski
    Avatar
    Community Member
    26 Posts

    Re: silverstripe book - error [RESOLVED] Link to this post

    The book is welcome but I'm disappointed with the lack of a decent site to support it. The book website referenced in the preface of the book simply sucks - there's almost nothing there for someone who has actually bought the book.

    Contrast this with a book like Zend Framework in Action published by Manning. The website set up for this book has a lot of information and functioning support forum, which is awesome if you want to connect with both the author(s) of the book and its readers.

  • kenlomax
    Avatar
    Community Member
    33 Posts

    Re: silverstripe book - error [RESOLVED] Link to this post

    There is an errata wiki page for this book at
    http://doc.silverstripe.org/doku.php?id=silverstripe-book-errata
    I have made a couple of postings there
    You may like to post a summary of your error there also.

    There is a code download at the www.wiley.com site mentioned in the front of the book.

    I did not find the error you have talked about, but maybe I didnt check enough. I am currently getting towards the end of chapter 6.

    Regards
    Ken

  • dalesaurus
    Avatar
    Community Member
    283 Posts

    Re: silverstripe book - error [RESOLVED] Link to this post

    Hey fellows, if you register for an account on the Wiki you can edit the page with your items:
    http://doc.silverstripe.org/doku.php?do=login

    The comments tend to get lost in the wind.

  • ttyl
    Avatar
    Community Member
    114 Posts

    Re: silverstripe book - error [RESOLVED] Link to this post

    The book is alright, but it isn't great. As programming books go I'd love to see something more polished come along. I went through it once in a fairly cursory way to get a feel for what it offered, but when I try to go back as a reference is largely falls flat. SS is hurting for documentation from my experience thus far.

  • chinaski
    Avatar
    Community Member
    26 Posts

    Re: silverstripe book - error [RESOLVED] Link to this post

    The book is going to help me as I am fairly new to the CMS and I want to do a couple of small projects with it over the next couple of months. I've looked at some other cms books and this one isn't the worst. As I said in an earlier post, the books major failing for me is that it lacks a dedicated support site.

    Documentation is great. I generally like to look at how-tos, tutorials, examples, snippets, - stuff that gets you up and running in a hurry - can't get enough of that. Silverstripe as a project is doing a decent job at this and hopefully will get better as time goes on and use of the software increases.

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