/** * {@inheritdoc} */ protected function build() { parent::build(); $value = $this->get('value'); if ($value) { $request = $this->getRequest(); $request->setBody(json_encode($value)); if ($this->jsonContentType && !$request->hasHeader('Content-Type')) { $request->setHeader('Content-Type', $this->jsonContentType); } } }
protected function build() { parent::build(); $entity = $this->get('entity'); if ($entity) { if ($entity instanceof Entity) { $entity = $entity->toArray(); } $request = $this->getRequest(); $request->setBody(json_encode($entity)); if ($this->jsonContentType && !$request->hasHeader('Content-Type')) { $request->setHeader('Content-Type', $this->jsonContentType); } } }