This post has NOT been accepted by the mailing list yet.
I'm new to ZF2, I have a small project to develop and would like to use it as a test case for start to learn how to work with it.
Because customer request, the main issue is that URLs, on the front-end, can't have flags:
tld.com/companyname -> not tld.com/company/companyname
tld.com/productname -> not tld.com/product/productname
tld.com/ownername -> not tld.com/owner/ownername
The project will have so 3 main entity and I would like to create 3 separate module (is that the best practice right?) Company, Owner, Product.
My first thought was to create a table on database where I'll store all slugs and query it for retrieve wich module load/execute.
Here my test, I'm using the quick start album app as base
'router' => array(
'routes' => array(
'home' => array(
'type' => 'Application\Router\MyRouter',
'options' => array(
'route' => '/[:slug]',
'constraints' => array(
'slug' => '[a-zA-Z0-9\-_\/]*'
'defaults' => array(
'controller' => 'Album\Controller\Album',
'action' => 'index'
the MyRouter class is exact copy of Zend\Mvc\Router\Http\Segment, the Album index is showed as well.
I've create a model for the index table.
What I would like to do is use the model inside MyRouter::match() method and then serve/load the right module, but I can't find the way to understand how to load the model from MyRouter.
It's that a right path to follow?
Any documentation (I've read some, but probably I misunderstand something), advice or critics are welcome :)
I've to use DI?