-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting Hal plugin in a module onBootstrap breaks admin api call #32
Comments
During bootstrap, we have not yet executed the router, so there are no route match parameters yet. If you invoke the plugin, and it's attempting to use defaults, it will fail due to the lack of parameters. I cannot reproduce the reported error by only pulling the plugin, however; are you sure you're not doing something else within the Originally posted by @weierophinney at zfcampus/zf-apigility-admin#294 (comment) |
Ah! So I've done much digging only to find this already-reported. I've minimized anything additional and come up with this:
array(
'ZF\\Apigility',
'ZF\\Apigility\\Provider',
'ZF\\Apigility\\Documentation',
'AssetManager',
'ZF\\ApiProblem',
'ZF\\MvcAuth',
'ZF\\OAuth2',
'ZF\\Hal',
'ZF\\ContentNegotiation',
'ZF\\ContentValidation',
'ZF\\Rest',
'ZF\\Rpc',
'ZF\\Versioning',
'Test',
)
public function onBootstrap($e)
{
$app = $e->getTarget();
$services = $app->getServiceManager();
$helpers = $services->get('ViewHelperManager');
$helpers->get('Hal');
}
Expected: {
"_links": {
"self": {
"href": "https://{{ application }}/api/apigility/api/module/Test/rest?version=1"
}
},
"_embedded": {
"rest": [
{
"accept_whitelist": [
"application/vnd.test.v1+json",
"application/hal+json",
"application/json"
],
"collection_class": "Test\\V1\\Rest\\Test\\TestCollection",
"collection_http_methods": [
"GET",
"POST"
],
"collection_name": "test",
"collection_query_whitelist": [],
"content_type_whitelist": [
"application/vnd.test.v1+json",
"application/json"
],
"controller_service_name": "Test-V1-Rest-Test-Controller",
"entity_class": "Test\\V1\\Rest\\Test\\TestEntity",
"entity_http_methods": [
"GET",
"PATCH",
"PUT",
"DELETE"
],
"entity_identifier_name": "id",
"hydrator_name": "Zend\\Stdlib\\Hydrator\\ArraySerializable",
"module": "Test",
"page_size_param": null,
"page_size": 25,
"resource_class": "Test\\V1\\Rest\\Test\\TestResource",
"route_identifier_name": "test_id",
"route_match": "/test[/:test_id]",
"route_name": "test.rest.test",
"selector": "HalJson",
"service_name": "Test",
"_links": {
"self": {
"href": "https://{{ application }}/api/apigility/api/module/Test/rest/Test-V1-Rest-Test-Controller"
},
"input_filter": {
"href": "https://{{ application }}/api/apigility/api/module/Test/rest/Test-V1-Rest-Test-Controller/input-filter"
},
"documentation": {
"href": "https://{{ application }}/api/apigility/api/module/Test/rest/Test-V1-Rest-Test-Controller/doc"
}
}
}
]
},
"total_items": 1
} Actual: {
"status": 500,
"title": "Unexpected error",
"describedBy": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html",
"detail": "Missing parameter \"name\"",
"details": {
"code": 0,
"message": "Missing parameter \"name\"",
"trace": "#0 /var/www/app/vendor/zendframework/zend-mvc/src/Router/Http/Segment.php(313): Zend\\Mvc\\Router\\Http\\Segment->buildPath(Array, Array, true, true, Array)\n#1 /var/www/app/vendor/zendframework/zend-mvc/src/Router/Http/Segment.php(409): Zend\\Mvc\\Router\\Http\\Segment->buildPath(Array, Array, false, true, Array)\n#2 /var/www/app/vendor/zendframework/zend-mvc/src/Router/Http/Part.php(197): Zend\\Mvc\\Router\\Http\\Segment->assemble(Array, Array)\n#3 /var/www/app/vendor/zendframework/zend-mvc/src/Router/Http/TreeRouteStack.php(331): Zend\\Mvc\\Router\\Http\\Part->assemble(Array, Array)\n#4 /var/www/app/vendor/zendframework/zend-mvc/src/Router/Http/Part.php(210): Zend\\Mvc\\Router\\Http\\TreeRouteStack->assemble(Array, Array)\n#5 /var/www/app/vendor/zendframework/zend-mvc/src/Router/Http/TreeRouteStack.php(331): Zend\\Mvc\\Router\\Http\\Part->assemble(Array, Array)\n#6 /var/www/app/vendor/zendframework/zend-mvc/src/Router/Http/Part.php(210): Zend\\Mvc\\Router\\Http\\TreeRouteStack->assemble(Array, Array)\n#7 /var/www/app/vendor/zendframework/zend-mvc/src/Router/Http/TreeRouteStack.php(352): Zend\\Mvc\\Router\\Http\\Part->assemble(Array, Array)\n#8 /var/www/app/vendor/zendframework/zend-view/src/Helper/Url.php(100): Zend\\Mvc\\Router\\Http\\TreeRouteStack->assemble(Array, Array)\n#9 [internal function]: Zend\\View\\Helper\\Url->__invoke('zf-apigility/ap...', Array, Array, true)\n#10 /var/www/app/vendor/zfcampus/zf-hal/src/Extractor/LinkExtractor.php(85): call_user_func(Object(Zend\\View\\Helper\\Url), 'zf-apigility/ap...', Array, Array, true)\n#11 /var/www/app/vendor/zfcampus/zf-hal/src/Extractor/LinkCollectionExtractor.php(52): ZF\\Hal\\Extractor\\LinkExtractor->extract(Object(ZF\\Hal\\Link\\Link))\n#12 /var/www/app/vendor/zfcampus/zf-hal/src/Plugin/Hal.php(718): ZF\\Hal\\Extractor\\LinkCollectionExtractor->extract(Object(ZF\\Hal\\Link\\LinkCollection))\n#13 /var/www/app/vendor/zfcampus/zf-hal/src/Plugin/Hal.php(729): ZF\\Hal\\Plugin\\Hal->fromLinkCollection(Object(ZF\\Hal\\Link\\LinkCollection))\n#14 /var/www/app/vendor/zfcampus/zf-hal/src/Plugin/Hal.php(495): ZF\\Hal\\Plugin\\Hal->fromResource(Object(ZF\\Hal\\Collection))\n#15 /var/www/app/vendor/zfcampus/zf-hal/src/View/HalJsonRenderer.php(119): ZF\\Hal\\Plugin\\Hal->renderCollection(Object(ZF\\Hal\\Collection))\n#16 /var/www/app/vendor/zendframework/zend-view/src/View.php(205): ZF\\Hal\\View\\HalJsonRenderer->render(Object(ZF\\Hal\\View\\HalJsonModel))\n#17 /var/www/app/vendor/zendframework/zend-mvc/src/View/Http/DefaultRenderingStrategy.php(103): Zend\\View\\View->render(Object(ZF\\Hal\\View\\HalJsonModel))\n#18 [internal function]: Zend\\Mvc\\View\\Http\\DefaultRenderingStrategy->render(Object(Zend\\Mvc\\MvcEvent))\n#19 /var/www/app/vendor/zendframework/zend-eventmanager/src/EventManager.php(444): call_user_func(Array, Object(Zend\\Mvc\\MvcEvent))\n#20 /var/www/app/vendor/zendframework/zend-eventmanager/src/EventManager.php(205): Zend\\EventManager\\EventManager->triggerListeners('render', Object(Zend\\Mvc\\MvcEvent), Array)\n#21 /var/www/app/vendor/zendframework/zend-mvc/src/Application.php(353): Zend\\EventManager\\EventManager->trigger('render', Object(Zend\\Mvc\\MvcEvent))\n#22 /var/www/app/vendor/zendframework/zend-mvc/src/Application.php(328): Zend\\Mvc\\Application->completeRequest(Object(Zend\\Mvc\\MvcEvent))\n#23 /var/www/app/public/index.php(44): Zend\\Mvc\\Application->run()\n#24 {main}"
}
} Originally posted by @robob4him at zfcampus/zf-apigility-admin#294 (comment) |
I'm having the same issue. I've tried fiddling a bit with the versions of the dependencies and it starts occurring when switching to version 1.5.x. Originally posted by @rokkie at zfcampus/zf-apigility-admin#294 (comment) |
Any solutions? Originally posted by @esilvajr at zfcampus/zf-apigility-admin#294 (comment) |
I have a strange error. As documentation say, I've done something like this to add a Link in an entity:
Just getting the
Hal
plugin, the route/api/module/:name/rest/:controller_service_name
is broken with the error messageMissing parameter "name"
and the following stack trace:Seems that route params are not passed correctly to the
TreeRouteStack
, but I don't know why it's happening when I get theHal
plugin on my module bootstrap.Originally posted by @thomasvargiu at zfcampus/zf-apigility-admin#294
The text was updated successfully, but these errors were encountered: