Skip to content

Commit

Permalink
Translating content without parent translations bug KMS-170
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksandra Augustyn committed Nov 25, 2015
1 parent 525a667 commit 4824034
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/Gzero/Api/Transformer/ContentTransformer.php
Expand Up @@ -47,7 +47,8 @@ public function transform($content)
{
$content = $this->entityToArray('\Gzero\Entity\Content', $content);
return [
'id' => (int) $content['id'],
'id' => $this->setNullableValue($content['id']),
'parentId' => $this->setNullableValue($content['parentId']),
'type' => $content['type'],
'weight' => (int) $content['weight'],
'isActive' => (bool) $content['isActive'],
Expand Down Expand Up @@ -133,4 +134,16 @@ private function buildPath($path)
}
return $result;
}

/**
* Returns integer value or null
*
* @param int $value to evaluate
*
* @return int|null
*/
private function setNullableValue($value)
{
return ($value !== null) ? (int) $value : null;
}
}

0 comments on commit 4824034

Please sign in to comment.