Comments (2)
There's little in the way of documentation for or recent information on AbstractRestfulController so I did this: using the latest version of the skeleton, I added a route to the module config:
'ping' => [
'type' => Segment::class,
'options' => [
'route' => '/ping[/:id]',
'defaults' => [
'controller' => Controller\PingController::class,
],
],
],
And added PingController:
<?php
namespace Application\Controller;
use Zend\Mvc\Controller\AbstractRestfulController;
class PingController extends AbstractRestfulController
{
public function getList()
{
return [
'now' => date(\DateTime::ISO8601)
];
}
}
(and added that controller to the controller factory)
... and it's "working". I dump the RouteMatch from inside getList and I get this:
Zend\Router\Http\RouteMatch Object
(
[length:protected] => 5
[params:protected] => Array
(
[controller] => Application\Controller\PingController
)
[matchedRouteName:protected] => ping
)
However, I also get a Zend\View runtime exception:
Unable to render template "application/ping/get-list"; resolver could not resolve to a file
I added the ViewJsonStrategy to the view manager but still received the same error. Maybe this stopped working way back when renderer selection based on Accept header was removed from those strategies (PR)? Or maybe I'm just not configuring the controller properly. In either case, AbstractRestfulController probably should be updated to use AcceptableViewModelSelector.
A quick Google didn't turn up any recent articles or mentions of AbstractRestfulController. I suspect that people have long since moved on to packages like ZfrRest or zf-rest or even rolling their own (eg: zend-router can do routing based on HTTP Method)
from zend-router.
Router does not set parameters on its own, none of the zend-mvc versions have 'index'
string either.
It is either from route configuration or some user registered listener in mvc application
from zend-router.
Related Issues (20)
- Segment routing and controller constraint HOT 2
- Disable the repo wiki HOT 2
- Segment optional parameters with childs HOT 1
- Translation issue with Router HOT 1
- Working with different locales fix proposal HOT 1
- Strange behaviour with constraints and segment child routes. HOT 1
- wrong dispatch HOT 1
- filterable routes HOT 7
- Slim 2 redirect is not working HOT 1
- Question on assemble() with TreeRouteStack + method routes HOT 1
- Unicode support in Segment and Regex routes is missing HOT 1
- Empty route type HOT 1
- Combination of MVC+Middleware+Wildcard Route give the error HOT 5
- Wildcard no longer works when route ends on slash HOT 3
- Config option to set TreeRouteStack::baseUri HOT 1
- Advanced Routing HOT 2
- Multilingual site in ZF3 HOT 2
- Slashes in route params are unescaped when passing uri option HOT 1
- Mark Query and Wildcard routes as deprecated HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zend-router.