开发者

Using sub classes with Zend_Rest_Server

Zend_Rest_Server and Zend_Rest_Client is pathetically under-documented, so I keep running into these mind numbing开发者_如何学JAVAly irritating problems.

So, in order to streamline my API methods I would invoke Zend_Rest_Server() and then set the server class to "X", which in turn would extend my "api_server" class. And in my api_server class would I put things like authentication, hash key processing and all that stuff.

But as soon as I use the "class mdb extends api_server {" instead of just "class mdb {" my entire api application dies. Without an error. Nothing in the logs. no output. Here is the code:

$server = new Zend_Rest_Server();
$server->setClass("mdb");
$server->handle();


class mdb extends api_server { .... }

And as soon as I remove the entire "extends api_server" it will work (although I don't have any authentication methods for the server, so it fails, but the server is running and responds..

So is this some sort of undocumented limit of Zend_Rest_Server() or am I doing something really stupid?

It doesn't seem to be about about autoloading, even if I require the file that the api_server class is kept in, it won't work.


Apparently, if you extend another class, you need to define it first, so the correct syntax would be:

class mdb extends api_server { .... }

$server = new Zend_Rest_Server();
$server->setClass("mdb");
$server->handle();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜