Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Commit

Permalink
Merge pull request #98 from ste93cry/fix-datetime-field-request-seria…
Browse files Browse the repository at this point in the history
…lization

Fix serialization of datetime fields not using the correct format
  • Loading branch information
mavimo committed Feb 11, 2019
2 parents 2493f3e + 9626f00 commit 938f956
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/LooplineSystems/CloseIoApiWrapper/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,15 @@ public function sendRequest(CloseIoRequest $request): CloseIoResponse
$requestBody = null;

if (!empty($request->getBodyParams())) {
$requestBody = json_encode($request->getBodyParams());
$params = $request->getBodyParams();

foreach ($params as $name => $value) {
if ($value instanceof \DateTimeInterface) {
$params[$name] = $value->format(DATE_ATOM);
}
}

$requestBody = json_encode($params);
}

$rawRequest = $this->messageFactory->createRequest($request->getMethod(), $request->getUrl(), [], $requestBody);
Expand Down

0 comments on commit 938f956

Please sign in to comment.