Skip to content

Commit

Permalink
#9236: allow for setData to take in an object of type DataObject
Browse files Browse the repository at this point in the history
  • Loading branch information
dmanners committed Jan 11, 2018
1 parent 41a4cf6 commit 9263b1d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/internal/Magento/Framework/Controller/Result/Json.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,13 @@ public function __construct(
* @param boolean $cycleCheck Optional; whether or not to check for object recursion; off by default
* @param array $options Additional options used during encoding
* @return $this
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function setData($data, $cycleCheck = false, $options = [])
{
if ($data instanceof \Magento\Framework\DataObject) {
$data = $data->toArray();
}
$this->json = $this->serializer->serialize($data);
return $this;
}
Expand Down

0 comments on commit 9263b1d

Please sign in to comment.