Introducing our first “Blog” Module


#1

Hello to newcomers.

If you struggle as myself while following tutorial from title of this topic in Zend Framework documentation, one thing you should do that is not mentioned there and that is clearing configuration cache to be able to use newly created module. As new to Zend I spent few days trying to reconsider what went wrong since I blindly followed tutorial but with no success to load new route from new module.
What I advice here is not way to have that kind of setting in production, but rather it will help you with introductory pitfalls which made me hard time trying to get out.
So you should to do next:

In /config/application.config.php file you have to do next two changes

  1. Disable config cache
'config_cache_enabled' => true,

should look like

'config_cache_enabled' => false,
  1. Disable module map cache
'module_map_cache_enabled' => true,

should look like

'module_map_cache_enabled' => false,

This time I would like to appeal to Zend Framework contributor developers to review documentation and this what I am pointing here because documentation is (if not only then) first station in our framework’s journey. Also, if there is better solution to avoid this pitfall from documentation it would be highly appreciated anyone who would add it here in topic. As said I am pretty much freshman in Zend Framework but one shouldn’t loose days for finding such a trivial issue.

To forum admins, my apology if category wasn’t good for this topic, I just found this as good contribution I would be happy with if same existed before.


#2

I think you mean the “In-Depth Tutorial” under the tutorials.

If you follow the description in the “Getting Started Tutorial”, the development mode should be activated during the installation.

How do you install the Skeleton Application?


#3

Thank you.
Just found it 5 minutes ago.
When development config file is renamed/merged and added to configuration array it behave that way.
Of course every solution has easier sister.
Actually seems there are two similar documentations. I followed this one from 2.4 manual.
Difference is that one you pointed propose doubling namespace directory structure i.e. /module/Blog/src/Blog With Module.php file in /module/Blog/src/Blog/Module.php and one I followed proposes /module/Blog/src with Module.php in /module/Blog/Module.php location.
That was problem two for me because in several files (composer.json, module.config.php, Module.php) there is lot of possibility for changing that or rather said have easy issue on that. Eventually I managed it but my biggest issue was cache.
Practice and module/package structure from your link should be followed as well?


#4

2.4 is outdated and no longer supported. The yellow box at the top of the page gives you the hint!


#5

Thank you very much.
Better to use composer.json's psr-4 autoload than getAutoloaderConfig in Module file?


#6

Yes, kill the autoloader config and use Composer instead!