I configured the routes as well as the other parts pretty well.
An important step to solving the issue was adding the following configuration section into my project "local.php".
//this is possible overwritten by the zf-rest module
'view-manager' => array(
'display_exceptions' => true,
'display_not_found_reason' => true
)
After that, I got back an response with the following content:
{"type":"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html","title":"Not Found","status":404,"detail":"Entity not found."
After adding a lot of debugging statements in the "ZF\Rest\RestController" (search for "Entity not found." ;-)), started understanding the issue.
The answer is pretty clear after all. Whenever you listen on a GET HTTP Method with your listener, you have to return an array with the configured "route_identifier_name" (the entity identifier), otherwise the controller as well as the HAL post processor is not able to successful build the response.
We had some controller tests in our test cases and the following error was thrown, after we updated to zend framework 2.4.
Zend\ServiceManager\Exception\ServiceNotFoundException: Zend\ServiceManager\ServiceManager::get was unable to fetch or create an instance for ApplicationConfig
/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php:555
/vendor/zendframework/zendframework/library/Zend/Mvc/Service/ModuleManagerFactory.php:41
/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php:939
/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php:1097
/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php:638
/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php:598
/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php:530
/vendor/zendframework/zendframework/library/Zend/Mvc/Application.php:253
/vendor/zendframework/zendframework/library/Zend/Test/PHPUnit/Controller/AbstractControllerTestCase.php:164
/vendor/zendframework/zendframework/library/Zend/Test/PHPUnit/Controller/AbstractControllerTestCase.php:73
//MyControllerTest.php:124
"MyControllerTest" extends "Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase". What we did to solve the problem was adding the following lines of code in our "setUp" method.
$applicationConfigurationPath = __DIR__ . str_repeat('/..', ) . '/config/application.config.php';
if (!is_file($applicationConfigurationPath)) {
$message = 'application configuration needed and not found in path "' . $applicationConfigurationPath . '"';
$this->fail($message);
}
$applicationConfiguration = require $applicationConfigurationPath;
unset($applicationConfiguration['module_listener_options']['config_glob_paths']);
$applicationConfiguration['modules'] = array();
$this->setApplicationConfig($applicationConfiguration);
I happy to announce the release of 1.1.0 of bazzlines zend framework 2 console helper (debian backport) module for php as well as the release of 1.1.0 of bazzlines zend framework 2 console helpermodule for php.
Important changes are: