[Bridge] Use original input values to guess context

This commit is contained in:
logmanoriginal 2016-09-02 19:46:58 +02:00
parent 4bc4e03d7b
commit 5f3d60276a

View file

@ -253,13 +253,12 @@ abstract class BridgeAbstract implements BridgeInterface {
} }
} }
protected function getQueriedContext(){ protected function getQueriedContext(array $inputs){
$queriedContexts=array(); $queriedContexts=array();
foreach(static::PARAMETERS as $context=>$set){ foreach(static::PARAMETERS as $context=>$set){
$queriedContexts[$context]=null; $queriedContexts[$context]=null;
foreach($set as $id=>$properties){ foreach($set as $id=>$properties){
if(isset($this->inputs[$context][$id]['value']) && if(isset($inputs[$id]) && !empty($inputs[$id])){
!empty($this->inputs[$context][$id]['value'])){
$queriedContexts[$context]=true; $queriedContexts[$context]=true;
}elseif(isset($properties['required']) && }elseif(isset($properties['required']) &&
$properties['required']===true){ $properties['required']===true){
@ -322,7 +321,7 @@ abstract class BridgeAbstract implements BridgeInterface {
$this->setInputs($inputs); $this->setInputs($inputs);
// Guess the paramter context from input data // Guess the paramter context from input data
$this->queriedContext = $this->getQueriedContext(); $this->queriedContext = $this->getQueriedContext($inputs);
if(is_null($this->queriedContext)){ if(is_null($this->queriedContext)){
$this->returnClientError('Required parameter(s) missing'); $this->returnClientError('Required parameter(s) missing');
} elseif($this->queriedContext === false){ } elseif($this->queriedContext === false){