// Merge from 1.4.X
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11221 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -46,6 +46,8 @@ class WebserviceOutputBuilderCore
|
|||||||
protected $fieldsToDisplay;
|
protected $fieldsToDisplay;
|
||||||
protected $specificFields = array();
|
protected $specificFields = array();
|
||||||
protected $virtualFields = array();
|
protected $virtualFields = array();
|
||||||
|
protected $statusInt;
|
||||||
|
protected $wsParamOverrides;
|
||||||
|
|
||||||
// Header properties
|
// Header properties
|
||||||
protected $headerParams = array(
|
protected $headerParams = array(
|
||||||
@@ -62,8 +64,10 @@ class WebserviceOutputBuilderCore
|
|||||||
|
|
||||||
public function __construct($ws_url)
|
public function __construct($ws_url)
|
||||||
{
|
{
|
||||||
|
$this->statusInt = 200;
|
||||||
$this->status = $_SERVER['SERVER_PROTOCOL'].' 200 OK';
|
$this->status = $_SERVER['SERVER_PROTOCOL'].' 200 OK';
|
||||||
$this->wsUrl = $ws_url;
|
$this->wsUrl = $ws_url;
|
||||||
|
$this->wsParamOverrides = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -184,6 +188,10 @@ class WebserviceOutputBuilderCore
|
|||||||
{
|
{
|
||||||
return $this->status;
|
return $this->status;
|
||||||
}
|
}
|
||||||
|
public function getStatusInt()
|
||||||
|
{
|
||||||
|
return $this->statusInt;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Set the return header status
|
* Set the return header status
|
||||||
*
|
*
|
||||||
@@ -192,6 +200,7 @@ class WebserviceOutputBuilderCore
|
|||||||
*/
|
*/
|
||||||
public function setStatus($num)
|
public function setStatus($num)
|
||||||
{
|
{
|
||||||
|
$this->statusInt = (int)$num;
|
||||||
switch ($num)
|
switch ($num)
|
||||||
{
|
{
|
||||||
case 200 :
|
case 200 :
|
||||||
@@ -315,6 +324,11 @@ class WebserviceOutputBuilderCore
|
|||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function registerOverrideWSParameters($wsrObject, $method)
|
||||||
|
{
|
||||||
|
$this->wsParamOverrides[] = array('object' => $wsrObject, 'method' => $method);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method is used for each content type
|
* Method is used for each content type
|
||||||
* Different content types are :
|
* Different content types are :
|
||||||
@@ -346,6 +360,11 @@ class WebserviceOutputBuilderCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
$ws_params = $objects['empty']->getWebserviceParameters();
|
$ws_params = $objects['empty']->getWebserviceParameters();
|
||||||
|
foreach ($this->wsParamOverrides AS $p)
|
||||||
|
{
|
||||||
|
$object = $p['object'];
|
||||||
|
$ws_params = $object->{$p['method']}($ws_params);
|
||||||
|
}
|
||||||
|
|
||||||
// If a list is asked, need to wrap with a plural node
|
// If a list is asked, need to wrap with a plural node
|
||||||
if ($type_of_view === self::VIEW_LIST)
|
if ($type_of_view === self::VIEW_LIST)
|
||||||
@@ -428,6 +447,11 @@ class WebserviceOutputBuilderCore
|
|||||||
{
|
{
|
||||||
$output = '';
|
$output = '';
|
||||||
$ws_params = $object->getWebserviceParameters();
|
$ws_params = $object->getWebserviceParameters();
|
||||||
|
foreach ($this->wsParamOverrides AS $p)
|
||||||
|
{
|
||||||
|
$o = $p['object'];
|
||||||
|
$ws_params = $o->{$p['method']}($ws_params);
|
||||||
|
}
|
||||||
$output .= $this->setIndent($depth).$this->objectRender->renderNodeHeader($ws_params['objectNodeName'], $ws_params);
|
$output .= $this->setIndent($depth).$this->objectRender->renderNodeHeader($ws_params['objectNodeName'], $ws_params);
|
||||||
|
|
||||||
if ($object->id != 0)
|
if ($object->id != 0)
|
||||||
@@ -489,7 +513,7 @@ class WebserviceOutputBuilderCore
|
|||||||
if ($field_name === 'id')
|
if ($field_name === 'id')
|
||||||
$show_field = false;
|
$show_field = false;
|
||||||
}
|
}
|
||||||
else if ($this->schemaToDisplay === 'blank')
|
if ($this->schemaToDisplay === 'blank')
|
||||||
if (isset($field['setter']) && !$field['setter'])
|
if (isset($field['setter']) && !$field['setter'])
|
||||||
$show_field = false;
|
$show_field = false;
|
||||||
|
|
||||||
|
|||||||
@@ -110,9 +110,9 @@ class WebserviceSpecificManagementSearchCore implements WebserviceSpecificManage
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This must be return an array with specific values as WebserviceRequest expects.
|
* This must be return a string with specific values as WebserviceRequest expects.
|
||||||
*
|
*
|
||||||
* @return array
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getContent()
|
public function getContent()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user