validateObject() public method

It is applicable only to either POST or PATCH methods. It should be used on GET methods.
public validateObject ( object $object, string $method = null )
$object object An object provided with the request
$method string optional HTTP METHOD
コード例 #1
0
ファイル: RoleAdapter.php プロジェクト: sacredwebsite/scalr
 /**
  * {@inheritdoc}
  * @see \Scalr\Api\DataType\ApiEntityAdapter::validateObject()
  */
 public function validateObject($object, $method = null)
 {
     parent::validateObject($object, $method);
     if (isset($object->scope) && $object->scope !== ScopeInterface::SCOPE_ENVIRONMENT) {
         throw new ApiErrorException(400, ErrorMessage::ERR_INVALID_VALUE, "Invalid scope");
     }
 }
コード例 #2
0
ファイル: RoleAdapter.php プロジェクト: mheydt/scalr
 /**
  * {@inheritdoc}
  * @see \Scalr\Api\DataType\ApiEntityAdapter::validateObject()
  */
 public function validateObject($object, $method = null)
 {
     parent::validateObject($object, $method);
     if (isset($object->scope) && $object->scope !== $this->controller->getScope()) {
         throw new ApiErrorException(400, ErrorMessage::ERR_INVALID_VALUE, "Invalid scope");
     }
 }
コード例 #3
0
ファイル: ScalingRuleAdapter.php プロジェクト: scalr/scalr
 /**
  * {@inheritdoc}
  * @see ApiEntityAdapter::validateObject()
  */
 public function validateObject($object, $method = null)
 {
     parent::validateObject($object, $method);
     if ($method === Request::METHOD_POST) {
         if (empty($object->name)) {
             throw new ApiErrorException(400, ErrorMessage::ERR_INVALID_STRUCTURE, 'Missed property name');
         }
         if ($object->ruleType === static::BASIC_SCALING_RULE xor !isset(ScalingMetricAdapter::$nameMap[$object->name])) {
             throw new ApiErrorException(400, ErrorMessage::ERR_INVALID_VALUE, 'Unexpected ruleType value');
         }
     }
 }