added method to parse post data

This commit is contained in:
Stefan Puraner
2016-05-20 17:34:22 +02:00
parent dfea2bab26
commit cf272c0e40
4 changed files with 50 additions and 44 deletions
+37 -5
View File
@@ -4,10 +4,42 @@ require_once APPPATH . '/libraries/REST_Controller.php';
class APIv1_Controller extends REST_Controller
{
function __construct()
{
parent::__construct();
//$this->load->library('session'); // -> autoload
//$this->load->library('database'); -> autoload
function __construct()
{
parent::__construct();
//$this->load->library('session'); // -> autoload
//$this->load->library('database'); -> autoload
}
/**
*
* @param type $data
* @return typeparses empty string to NULL
*/
protected function _parseData($data)
{
if(is_array($data))
{
foreach($data as $key=>$value)
{
if($value === "")
{
$data[$key] = NULL;
}
}
return $data;
}
elseif(is_object($data))
{
//TODO
}
else
{
if($data == "")
{
return NULL;
}
}
}
}