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.

General Questions /

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

Tutorial 2 freezes at dev/build with ArticleHolder.php


Reply


5 Posts   467 Views

Avatar
ZaxisGeorge

Community Member, 5 Posts

15 October 2013 at 4:14pm

// Below is the code (cut and pasted from the tutorial) that causes freezing at "Page" in the dev/build process

<?php
class ArticleHolder extends Page {
private static $allowed_children = array('ArticlePage');
}
class ArticleHolder_Controller extends Page_Controller {
}

// if line 3 is commented out as shown below, the dev/build completes successfully

<?php
class ArticleHolder extends Page {
// private static $allowed_children = array('ArticlePage');

}
class ArticleHolder_Controller extends Page_Controller {
}

/*
I've tried multiple iterations - edits of "private" and "static" out of line 3 without success. The Silver Stripe package was installed with WebMatrix 3. What is line 3 doing to crash the dev/build?
*/

Avatar
FriedBuffalo

Community Member, 5 Posts

18 October 2013 at 1:52pm

The documentation on tutorial 2 is wrong, private static should be public static I belive.

Using private static prints an error message with error reporting turned on:
Fatal error: Access level to ArticleHolder::$allowed_children must be public (as in class Page)

I found this article really helpful, Dev mode should enable error reporting. Turning error reporting in php.ini is also really helpful for debugging too.

http://doc.silverstripe.org/framework/en/topics/debugging

Avatar
ZaxisGeorge

Community Member, 5 Posts

19 October 2013 at 4:31am

Thank you Fried Buffalo! Unfortunately, changing the declaration to public made no difference - see attachment.

By default isn't the system is in"dev" mode automatically when running /dev/build?
And the line in _ss_environment.php - define('SS_ENVIRONMENT_TYPE', 'dev') - sets the site in dev mode at initial installation?
Yet the error reporting as shown in the attached file is insufficient [for me].

Also, I changed error reporting in the php.ini file from:
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT to error_reporting = E_ALL in C:\Program Files (x86)\IIS Express\PHP\v5.4

The dev/build froze with the same result at page.

How can I justify continuing to try to work -learn-develop with SilverStripe if the tutorial fails at lesson 2?

Avatar
FriedBuffalo

Community Member, 5 Posts

19 October 2013 at 1:39pm

Edited: 19/10/2013 1:56pm

Hmm... a direct copy+paste and changing the declaration builds successfully on my end (using 3.1). Are you also using 3.x?

The configs seem to be setup correctly so far, although I'd also ensure PHP's display_errors and display_startup_errors are enabled to ensure the E_ALL is being read.

The screenshots show ArticlePage is building successfully, so I doubt there's a missing/typo'd class which is normally the source of my dev/build fails.

SilverStripe has a rough initial learning curve (I also hit a brick wall at tutorial 2 due to the beginners tutorial/docs having not caught up to 3.1 yet) but there's definitely rewards in the form of a focused, extensible API and rapid development speed if you stick to it.

Avatar
ZaxisGeorge

Community Member, 5 Posts

19 October 2013 at 4:17pm

Thank you again FB!

Given your encouraging ending paragraph, I created a clean install, changed the declaration to public and ran dev/build again. Voila! - successful build.

I'll work on the PHP error displays as suggested and move on with the tutorial.