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

silverstripe book - error [RESOLVED]

Go to End

9 Posts   3056 Views


Community Member, 26 Posts

19 November 2009 at 5:23am

Edited: 20/11/2009 11:36am

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?


Community Member, 26 Posts

19 November 2009 at 9:40am

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


Community Member, 283 Posts

19 November 2009 at 3:19pm

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


Community Member, 26 Posts

20 November 2009 at 2:46am

Edited: 20/11/2009 11:35am

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.


Community Member, 33 Posts

20 November 2009 at 5:14am

There is an errata wiki page for this book at
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 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.



Community Member, 283 Posts

20 November 2009 at 4:27pm

Hey fellows, if you register for an account on the Wiki you can edit the page with your items:

The comments tend to get lost in the wind.


Community Member, 114 Posts

21 November 2009 at 8:55am

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.


Community Member, 26 Posts

21 November 2009 at 10:13am

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.

Go to Top