0

Zend_Rest_Server and Zend_Rest_Client is pathetically under-documented, so I keep running into these mind numbingly 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.

Charles
  • 50,943
  • 13
  • 104
  • 142
Sandman
  • 2,323
  • 5
  • 28
  • 34

1 Answers1

0

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();
Sandman
  • 2,323
  • 5
  • 28
  • 34