Hello
How do you import this class? Show code
If you enable devel mode and show errors, what do you get?
Best regards
Robert
Hi soft-solid,
Thank you for your reply,
Here are the classes,
Class1 is in myaddon1.
MyApi is an API class which I develop now.
when I call MyApi from postman I get only 500 status. but no idea what the error is. It would be great if you can tell me how to capture those API errors for debugging. May be how to do log errors?
class 1
Path : app\addons\myaddon1\class1.php
namespace Tygh\Addons\myaddon1;
class Class1 {
public $var;
public function class1fun(){
$this->var = "from class 1 funct";
return $this->var;
}
}
API class
namespace Tygh\Api\Entities;
use Tygh;
use Tygh\Api\AEntity;
use Tygh\Api\Response;
use Tygh\Registry;
use Tygh\Addons\myaddon1\Class1;
class MyApi extends AEntity{
public function index($id = '', $params = array())
{
$status = Response::STATUS_OK;
$obj1 = new Class1();
$data = $obj1->class1fun();
return array(
'status' => $status,
'data' => $data
);
}
public function create($params)
{
return array(
'status' => Response::STATUS_METHOD_NOT_ALLOWED,
'data' => $data
);
}
public function update($id, $params)
{
return array(
'status' => Response::STATUS_METHOD_NOT_ALLOWED,
'data' => array()
);
}
public function delete($id)
{
return array(
'status' => Response::STATUS_METHOD_NOT_ALLOWED,
'data' => array()
);
}
public function privileges()
{
return array(
'index' => true,
'create' => false,
'update' => false,
'delete' => false,
);
}
}