Followed the Cake Book example almost exactly.
Router::mapResources('incidentReports');
Router::parseExtensions('json');
Both before
require CAKE . 'Config' . DS . 'routes.php';
My controller called IncidentReportsController
class IncidentReportsController extends AppController {
Which contains functions
index()
view($id)
add()
edit($id)
delete($id)
Going to the URL
www.myurl.com/incidentReports.json
Sends the request to the index() function as expected.
Going to the URL
www.myurl.com/incidentReports/260.json
Should map to the view() function but trys to map to a 260() function which doesn't exist.
www.myurl.com/incidentReports/view/260.json
Does map to the view() function and works properly. However, my understanding is the "view" in the URL shouldn't be necessary.
Had the same issue. In my case I was able to fix it by changing the controller name in the URL.
Didn't work: http://www.example.com/entityName.json
Works fine: http://www.example.com/entity_name.json
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With