@param mixed  $bodyEntity
@param string $requestFormat

@return $this
971457
public function setBodyEntity($bodyEntity, $requestFormat = null)
    {
        $this->bodyEntity = $bodyEntity;
        if ($requestFormat !== null) {
            $this->setRequestFormat($requestFormat);
        }

        return $this;
    }
67962
protected function CreateObject($methodKey, $entity, $responseClassName = null, $entityId = null, $subEntityId = null, $idempotencyKey = null)
    {
        if (is_null($entityId)) {
            $urlMethod = $this->GetRequestUrl($methodKey);
        } elseif (is_null($subEntityId)) {
            $urlMethod = sprintf($this->GetRequestUrl($methodKey), $entityId);
        } else {
            $urlMethod = sprintf($this->GetRequestUrl($methodKey), $entityId, $subEntityId);
        }

        $requestData = null;
        if (!is_null($entity)) {
            $requestData = $this->BuildRequestData($entity);
        }

        $rest = new RestTool(true, $this->_root);
        $response = $rest->Request($urlMethod, $this->GetRequestType($methodKey), $requestData, $idempotencyKey);

        if (!is_null($responseClassName)) {
            return $this->CastResponseToEntity($response, $responseClassName);
        }

        return $response;
    }
601649
public function getCreateForm ($requestOrDataArray, array $options=array(), $entity=false)
    {
        $formBuilder = $this->Core->getFormFactory();
        if (false === $entity) {
            $newEntity = new $this->entityClass();
        } else {
            $newEntity = $entity;
        }
        $createForm  = $formBuilder->create(new $this->createFormClass(), $newEntity, $options);

        // Bind request data to form
        if (is_array($requestOrDataArray)) {
            $createForm->submit($requestOrDataArray);
        } else {
            $createForm->handleRequest($requestOrDataArray);
        }

        return $createForm;
    }
429204
private function displayEntity($entityName, EntityManagerInterface $entityManager, SymfonyStyle $ui)
    {
        $metadata    = $this->getClassMetadata($entityName, $entityManager);
        $parentValue = $metadata->getParent() === null ? '<comment>None</comment>' : '';

        $ui->table(
            ['Field', 'Value'],
            array_merge(
                [
                    $this->formatField('Name', $metadata->getClassName()),
                    $this->formatField('Root entity name', $metadata->getRootClassName()),
                    $this->formatField('Custom repository class', $metadata->getCustomRepositoryClassName()),
                    $this->formatField('Mapped super class?', $metadata->isMappedSuperclass),
                    $this->formatField('Embedded class?', $metadata->isEmbeddedClass),
                    $this->formatField('Parent classes', $parentValue),
                ],
                $this->formatParentClasses($metadata),
                [
                    $this->formatField('Sub classes', $metadata->getSubClasses()),
                    $this->formatField('Embedded classes', $metadata->getSubClasses()),
                    $this->formatField('Identifier', $metadata->getIdentifier()),
                    $this->formatField('Inheritance type', $metadata->inheritanceType),
                    $this->formatField('Discriminator column', ''),
                ],
                $this->formatColumn($metadata->discriminatorColumn),
                [
                    $this->formatField('Discriminator value', $metadata->discriminatorValue),
                    $this->formatField('Discriminator map', $metadata->discriminatorMap),
                    $this->formatField('Table', ''),
                ],
                $this->formatTable($metadata->table),
                [
                    $this->formatField('Composite identifier?', $metadata->isIdentifierComposite()),
                    $this->formatField('Change tracking policy', $metadata->changeTrackingPolicy),
                    $this->formatField('Versioned?', $metadata->isVersioned()),
                    $this->formatField('Version field', ($metadata->isVersioned() ? $metadata->versionProperty->getName() : '')),
                    $this->formatField('Read only?', $metadata->isReadOnly()),

                    $this->formatEntityListeners($metadata->entityListeners),
                ],
                [$this->formatField('Property mappings:', '')],
                $this->formatPropertyMappings($metadata->getDeclaredPropertiesIterator())
            )
        );
    }
766890
public function sendFormData( FormData$body ):Response
	{
		if(!( in_array( $this->method, [ 'POST', 'PUT', 'PATCH', ] ) )){
			throw new \Exception('FormData must be send with method POST, PUT or PATCH');
		}

		$body->setRequest( $this );

		return $this->send("$body");
	}
112883
public function addFunc(FunctionEntity $func)
    {
        $this->fullClassName = $func->getClass();

        // Skip the method if it's an @internal one.
        $methodFullDoc = (new ReflectionMethod($this->fullClassName, $func->getName()))->getDocComment();
        foreach (explode(PHP_EOL, $methodFullDoc) as $line) {
            if (strpos($line, ' @internal ') !== false) {
                return '';
            }
        }

        $str = PHP_EOL . '<h3>' . $func->getName() . '</h3>' . "\n\n<hr>\n\n";

        $str .= $this->parser->text($func->getDescription());

        if (!$func->getExample()) {
            throw new RuntimeException("Method {$func->getClass()}::{$func->getName()} is missing an example.");
        }

        $rawExample = $func->getExample();
        $example = $this->parser->text($rawExample);
        $str .= PHP_EOL . $example;

        if ($func->hasParams()) {
            $str .= PHP_EOL . '<h4>Parameters</h4>' . PHP_EOL . '<ul>';
            $params = [];
            foreach ($func->getParams() as $param) {
                $paramStr = sprintf('<li><code>%s</code> <strong>%s</strong>', $param->getType(), $param->getName());

                $description = $param->getDescription();

                if (!empty($description)) {
                    $paramStr .= ' - ' . $this->parser->line($param->getDescription());
                }

                $params[] = $paramStr . '</li>';
            }
            $str .= PHP_EOL . implode(PHP_EOL, $params);
            $str .= '</ul>';
        }


        $this->output .= PHP_EOL . $str . PHP_EOL  . '  ';
        $this->index[] = $func->getName();
        return $str;
    }
1128672
protected function verifyErrorFormat($body, $httpStatusCode)
    {
        if (is_array($body) === false)
        {
            $this->throwServerError($body, $httpStatusCode);
        }

        if ((isset($body['error']) === false) or
            (isset($body['error']['code']) === false))
        {
            $this->throwServerError($body, $httpStatusCode);
        }

        $code = $body['error']['code'];

        if (Errors\ErrorCode::exists($code) === false)
        {
            $this->throwServerError($body, $httpStatusCode);
        }
    }
66089
protected function parseToJson($resBody, $requestId)
    {
        if ( ! $resBody) {
            return null;
        }

        $result = json_decode($resBody, true);

        if (is_null($result)) {
            throw new Exception ("[BadResponse] Bad format,not json: $resBody", 0, $requestId);
        }

        return $result;
    }
230846
protected function processEntityFormRequest(Entity $entity, FormData $requestData, $revision) {
    $this->addOptionalProperty('contentStreams');
    
    // erst formular bearbeiten
    parent::processEntityFormRequest($entity, $requestData, $revision);
    
    // wenn es neu ist, wollen wir die content streams erstellen
    if ($entity->isNew()) {
      $this->fillContentStreams($entity);
    }
  }
491840
public function setBody(Body $body)
    {
        $this->body = $body;
        $this->setAllHeaders($body->getHeaders());
        $this->setStatus($body->getStatusCode());

        return $this;
    }
1038183
public function setBody(?MessageBody $body) : Message
    {
        $this->body = $body;

        if ($body) {
            $size = $body->getSize();

            if ($size === null) {
                $this->setHeader('Transfer-Encoding', 'chunked');
                $this->removeHeader('Content-Length');
            } else {
                $this->setHeader('Content-Length', (string) $size);
                $this->removeHeader('Transfer-Encoding');
            }
        } else {
            $this->removeHeader('Content-Length');
            $this->removeHeader('Transfer-Encoding');
        }

        return $this;
    }
429660
protected function doRequest($params, $answerFormat = ConnectorInterface::ANSWER_FORMAT_ARRAY)
    {
        $data = [
            'method' => $this->method,
            'params' => $params
        ];

        return $this->connector->doRequest($this->apiName, $data, $answerFormat);
    }
1219438
public static function castFrom($requestUri, string $requestMethod = null)
    {
        if ($requestUri instanceof self) {
            return $requestUri;
        }

        return new self($requestUri, (string) $requestMethod);
    }
855565
public function setBody($body, $html = false)
    {
        if ($html) {
            $this->body['text/html'] = $body;
            $body = strip_tags($body);
        }
        
        $this->body['text/plain'] = $body;
        
        return $this;
    }
1301518
private function validateBody($body, $requestHeaders)
    {
        $signature = $this->getHeaderValue($requestHeaders, 'X-GCS-Signature');
        $keyId = $this->getHeaderValue($requestHeaders, 'X-GCS-KeyId');
        $secretKey = $this->secretKeyStore->getSecretKey($keyId);

        $expectedSignature = base64_encode(hash_hmac("sha256", $body, $secretKey, true));

        $isValid = $this->areEqualSignatures($signature, $expectedSignature);
        if (!$isValid) {
            throw new SignatureValidationException("failed to validate signature '$signature'");
        }
    }
1178498
public function setBody($body, $contentType = null, $charset = null)
    {
        if (isset($charset)) {
            $this->setCharset($charset);
        }
        $body = $this->convertString($body);

        parent::setBody($body, $contentType);

        return $this;
    }
904573
public function setTrackingCodeAction(Request $request, $id)
    {
        $em = $this->getDoctrine()->getManager();

        /** @var Transaction $entity */
        $entity = $em->getRepository('EcommerceBundle:Transaction')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Transaction entity.');
        }

        $form = $this->createFormBuilder($entity->getDelivery())
            ->add('trackingCode', 'text', array(
                    'required' => true
                ))
            ->getForm();

        if ($request->isMethod('POST')) {
            $form->bind($request);

            if ($form->isValid()) {
                $entity->setStatus(Transaction::STATUS_DELIVERED);

                $em->persist($entity);
                $em->flush();

                $this->get('core.mailer')->sendTrackingCodeEmailMessage($entity);

                $this->get('session')->getFlashBag()->add('success', 'transaction.sent');
            }else{
                $string = (string) $form->getErrors(true, false);
                print_r($string);
                die('invalid');
            }

            return $this->redirect($this->generateUrl('ecommerce_transaction_show', array('id' => $entity->getId())));
        }

        return array(
            'entity' => $entity,
            'form'   => $form->createView()
        );
    }