Closed luoihoc closed 12 years ago
I was able to make my code to run by change all the variables in REST_Controller.php from "protected" to "private"
private $rest_format = NULL; // Set this in a controller to use a default format
private $methods = array(); // contains a list of method properties such as limit, log and level
private $request = NULL; // Stores accept, language, body, headers, etc
private $response = NULL; // What is gonna happen in output?
private $rest = NULL; // Stores DB, keys, key level, etc
private $_get_args = array();
private $_post_args = array();
private $_put_args = array();
private $_delete_args = array();
private $_args = array();
private $_allow = TRUE;
// List all supported methods, the first will be the default format
private $_supported_formats = array(
'xml' => 'application/xml',
'rawxml' => 'application/xml',
'json' => 'application/json',
'jsonp' => 'application/javascript',
'serialized' => 'application/vnd.php.serialized',
'php' => 'text/plain',
'html' => 'text/html',
'csv' => 'application/csv'
);
This may relate to this bug report: https://github.com/philsturgeon/codeigniter-template/issues/22
Thanks luoihoc, that solved my problem!
Can somebody send in a pull request?
Hey Phil This issue has been closed but the changes were never made, was this fixed elsewhere?
If its still broken please send in a pull request that fixes it.
I will take a look at it either this evening or tomorrow and send along a pull request.
Thanks buddy.
Phil Sturgeon
On Wednesday, 23 January 2013 at 07:32, Steven Bullen wrote:
Hey Phil This issue has been closed but the changes were never made, was this fixed elsewhere?
— Reply to this email directly or view it on GitHub (https://github.com/philsturgeon/codeigniter-restserver/issues/69#issuecomment-12593506).
worked for me making only $rest private;
hey, the final fixed is still not pulled to the latest Rest Server library ?
REST_Controller is to be extended, I prefer its properties to be protected, not private.
Agreed
then what should be the correct approach if we want to use the same class as a Rest server and Client together ?
That isn't maintained by us is it?
First thoughts:
Meanwhile... $this->load->library('rest', $config, 'rest_client');
I will confess I have never used Rest_client nor probably will I ever. But I am game if everyone else is =)
In my demo with the Rest Client library I did not extend the controller class from REST_Controller, but at least the following commit shows how can the name conflict be resolved: https://github.com/ivantcholakov/starter-public-edition-3/commit/0030a94d3c20e853c3baf823312eee9ae4db9389
Also, the REST client library should be renamed, because the configuration file of the REST_Controller is named as rest.php. This is a second name conflict.
With a renamed client library, if we want to define some configuration options, its configuration file will be named as rest_client.php.
@chriskacerguis
What do you think about putting the REST client library an the Curl library in this project? I can make the initial commits and put some tests. Then (@softwarespot) conversion to PHP 5.4 follows and some polishing.
If I have time =)
No problem, I can cover the whole thing.
I installed rest-client library using sparks command line. When i try to load the rest-client library in a Rest Controller, i have the following error
This is the code in my Rest Controller