Jump to:

22977 Posts in 11742 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » Tutorial 2 freezes at dev/build with ArticleHolder.php

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
Go to End
Author Topic: 305 Views
  • ZaxisGeorge
    Avatar
    Community Member
    5 Posts

    Tutorial 2 freezes at dev/build with ArticleHolder.php Link to this post

    // 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?
    */

  • FriedBuffalo
    Avatar
    Community Member
    5 Posts

    Re: Tutorial 2 freezes at dev/build with ArticleHolder.php Link to this post

    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

  • ZaxisGeorge
    Avatar
    Community Member
    5 Posts

    Re: Tutorial 2 freezes at dev/build with ArticleHolder.php Link to this post

    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?

  • FriedBuffalo
    Avatar
    Community Member
    5 Posts

    Re: Tutorial 2 freezes at dev/build with ArticleHolder.php Link to this post

    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.

  • ZaxisGeorge
    Avatar
    Community Member
    5 Posts

    Re: Tutorial 2 freezes at dev/build with ArticleHolder.php Link to this post

    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.

    305 Views
Page: 1
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.