Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 protected function build()
 {
     // Prepare and serialize the request
     $this->request = $this->getRequestSerializer()->prepare($this);
     // If no response parser is set, add the default parser if a model matching the responseClass is found
     if (!$this->responseParser) {
         $this->responseParser = $this->operation->getResponseType() == OperationInterface::TYPE_MODEL && $this->get(self::RESPONSE_PROCESSING) == self::TYPE_MODEL ? OperationResponseParser::getInstance() : DefaultResponseParser::getInstance();
     }
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 protected function build()
 {
     // By default, JSON commands with AWS require no response model processing
     if ($this->operation->getResponseType() == OperationInterface::TYPE_MODEL && $this->get(self::RESPONSE_PROCESSING) == self::TYPE_MODEL) {
         $this->responseParser = $this->get('command.model_processing') ? OperationResponseParser::getInstance() : NoTranslationOperationResponseParser::getInstance();
     } else {
         $this->responseParser = DefaultResponseParser::getInstance();
     }
     parent::build();
     // Ensure that the body of the request ALWAYS includes some JSON. By default, this is an empty object.
     if (!$this->request->getBody()) {
         $this->request->setBody('{}');
     }
     // Never send the Expect header when interacting with a JSON query service
     $this->request->removeHeader('Expect');
 }
 /**
  * Create the result of the command after the request has been completed.
  * Override this method in subclasses to customize this behavior
  */
 protected function process()
 {
     $this->result = $this[self::RESPONSE_PROCESSING] != self::TYPE_RAW ? DefaultResponseParser::getInstance()->parse($this) : $this->request->getResponse();
 }