PHP Fatal error: Class 'Url' not found

Hi,

I have recently added phalcon via cpanel's EasyApache, and am working my way through the tutorials on the website.

Unfortunately I am having an issue with the very first tutorial (http://docs.phalconphp.com/en/latest/reference/tutorial.html).

When I add

> echo $this->tag->linkTo("signup", "Sign Up Here!");

to my index/index.phtml file I get an error relating to the Url class, rather than the expected signup link.

> [02-May-2015 16:59:54 UTC] PHP Fatal error: Class 'Url' not found in /{path_to}/tutorial1/public/index.php on line 30

If I remove the tag from the phtml, then the error does not occur (suggesting the script autoloaded the Url class ok).

However, if I edit the index.php file, and use the full qualified path to the Url class (or the alternative defined when loading up the namespaces), then the error does not occur, and the tag also loads correctly.

e.g.

> $url = new Phalcon\Mvc\Url();

or

> $url = new UrlProvider();

instead of

> $url = new Url();

This would suggest that when the Tag class is autoloaded, it is breaking the ability for the script to load the Url class. I assume this is why the namespace was modified in the first place??

The script also works if the "as UrlProvider" is removed from the use statement.

Is this just an error in the tutorial?

This is definitely a typo. I've made PRs in the docs repo so it should be fixed shortly:

edited May '15

I've found another inconsistancy in the documentation.

During the tutorial 'Securing INVO' the documentation advises that the dispatcher forwards guests to index/index with a flash error, however in the source code, the dispatcher actually forwards to errors/show401

documentation (http://docs.phalconphp.com/en/latest/reference/tutorial-invo-2.html)

if ($allowed != Acl::ALLOW) {
    //If he doesn't have access forward him to the index controller
    $this->flash->error("You don't have access to this module");
    $dispatcher->forward(
        array(
            'controller' => 'index',
            'action'     => 'index'
        )
    );

    //Returning "false" we tell to the dispatcher to stop the current operation
    return false;
}

github source (/app/plugins/SecurityPlugin.php)

if ($allowed != Acl::ALLOW) {
    $dispatcher->forward(array(
        'controller' => 'errors',
        'action'     => 'show401'
    ));
    return false;
}

Additionally, when checking the getAcl() function from the github source, it would seem that the guest user doesn't have access to the show401 error, just show404 and show500.

//Public area resources
    $publicResources = array(
    'index'      => array('index'),
    'about'      => array('index'),
    'register'   => array('index'),
    'errors'     => array('show404', 'show500'),
    'session'    => array('index', 'register', 'start', 'end'),
    'contact'    => array('index', 'send')
);

Would it make sense to edit the title of this thread to something like 'Tutorial Errors' and continue to update it if I find any more as I work my way through the tutorials?

edited Jun '15

When you get to the end of the Tutorial, there is a webpage containing a list of full applications that can be used to learn more about Phalcon.

https://docs.phalconphp.com/en/latest/reference/samples.html

With exception of the Phalcon Website application

A few of those links go to to blog posts that no longer exist

INVO and Vokuro are obviously not an issue if you've worked through the documentation, but it would be nice if the page was updated with links that actually take you to the downloads.

I am assuming that these are the right locations??