Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

Commit

Permalink
fix(Review): fix locale serialization for review models
Browse files Browse the repository at this point in the history
  • Loading branch information
Jens Schulze committed Mar 10, 2016
1 parent 1e91492 commit 973129d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Model/Review/Review.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,13 @@ public function fieldDefinitions()
'custom' => [static::TYPE => '\Commercetools\Core\Model\CustomField\CustomFieldObject'],
];
}

public function jsonSerialize()
{
$data = parent::jsonSerialize();
if (isset($data['locale'])) {
$data['locale'] = str_replace('_', '-', $data['locale']);
}
return $data;
}
}
9 changes: 9 additions & 0 deletions src/Model/Review/ReviewDraft.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,13 @@ public static function ofRating($rating, $context = null)
{
return static::of($context)->setRating($rating);
}

public function jsonSerialize()
{
$data = parent::jsonSerialize();
if (isset($data['locale'])) {
$data['locale'] = str_replace('_', '-', $data['locale']);
}
return $data;
}
}
9 changes: 9 additions & 0 deletions src/Request/Reviews/Command/ReviewSetLocaleAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,13 @@ public function __construct(array $data = [], $context = null)
parent::__construct($data, $context);
$this->setAction('setLocale');
}

public function jsonSerialize()
{
$data = parent::jsonSerialize();
if (isset($data['locale'])) {
$data['locale'] = str_replace('_', '-', $data['locale']);
}
return $data;
}
}

0 comments on commit 973129d

Please # to comment.