I am currently trying to learn more about ZF2 in general and I have cloned
the skeleton application and the skeleton module. 

I can get the skeleton application to run and the skeleton module, however
when I try to follow the quick start for the MVC
(http://packages.zendframework.com/docs/latest/manual/en/zend.mvc.quick-start.html)
I can't get it to work. 

My module.config.php code is 

<code>
<?php
return array(
    'di' => array(
        'instance' => array(
            'Zend\Mvc\Router\RouteStack' => array(
                'parameters' => array(
                    'routes' => array(
                        'wdev-base-hello-world' => array(
                            'type'    => 'Zend\Mvc\Router\Http\Literal',
                                'options' => array(
                                'route' => '/hello/world',
                                'defaults' => array(
                                    'controller' =>
'WdevBase\Controller\HelloController',
                                    'action'     => 'world',
                                ),
                            ),
                        ),
                    ),
                ),
            ),
        ),
        // ... other di configuration ...
    ),
);
</code>

and my HelloController code is 

<code>
<?php

namespace WdevBase\Controller;

use Zend\Mvc\Controller\ActionController;
    

class HelloController extends ActionController
{
    
    public function indexAction()
    {
        return array();
    }
    
    
    public function worldAction()
    {
        $message = $this->getRequest()->query()->get('message', 'foo');
        return new ViewModel(array('message' => $message));
    }
}
</code>

My module is called WdevBase.

The error message i receive is 

" Fatal error: Class 'WdevBase\Controller\ViewModel' not found in
C:\sites\site\module\WdevBase\src\WdevBase\Controller\HelloController.php on
line 20"

Any input on how i can get this to work would be great.




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/ZF2-Skeleton-Module-and-hello-world-tp4575541p4575541.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to