Dear Community,
I try the restful api as described in docu:
https://docs.modx.com/3.x/en/extending-modx/developing-restful-api
I have modx 3.01 test installation and created a custom table “todos”.
I used ExraBuilder.
With a test snippet I get data:
<?php
$items = $modx->getCollection('todo\Model\Todos');
$output= [];
foreach($items as $item){
$item_array = $item->toArray();
$output[] = json_encode($item_array);
}
return implode("<br>", $output);
I created a Controller unter /rest/Contollers/Todos.php
<?php
class MyControllerTodos extends \MODX\Revolution\Rest\modRestController
{
public $classKey = 'Todos';
public $defaultSortField = 'id';
public $defaultSortDirection = 'ASC';
}
But I got alwas no data from api: total 0
In error_log I have the following:
|ERROR|/www/reacttest/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php|666|
|Could not load class: Todos from mysql.todos|
What do I have made wrong?
Thank you in advance.
Bye
Chris