0
votes

I am having trouble with the workflow when creating new modules/controllers to the ZF2 Skeleton Application.

I created a new module test and navigated to mydomain/test. This returns a 404 error until I do the following:

  1. Define my Module in the global config file
  2. Define my route in my module config file
  3. Define my Controller as an invokables in the module config file
  4. Define the path of my view as a view_manager in the module Config file

I am new to ZF2 and trying to better understand the workflow for Application development. This seems like a very cumbersome way to develop, as there is so much configuration needed.

(Rapid application Development??)

Is there a Default means of defining literal routes, controllers, and view rendering in ZF2?

1

1 Answers

3
votes
  1. Create your module with zftool, it will add it to your global config.
  2. You will have to create at least one route for each module, take a look at the route in the Application module with this route you're covering allot the comment says:

    The following is a route to simplify getting started creating new controllers and actions without needing to create a new module. Simply drop new controllers in, and you can access them using the path /application/:controller/:action

  3. You will have to add controller to the invokables

  4. Use template_path_stack:

    'view_manager' => array(
        'template_path_stack' => array(
            __DIR__ . '/../view',
        ),
    )
    

    i use template_path_stack during development and template_map in production