Skip to content

Commit

Permalink
Merge pull request #21 from emil-nasso/relationships-emptydata
Browse files Browse the repository at this point in the history
Relationships with empty data, issue #20
  • Loading branch information
kocsismate committed May 3, 2016
2 parents 06c3b5e + a6cb118 commit d4e9633
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/JsonApi/Schema/Relationship/AbstractRelationship.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function transform(
) {
$transformedData = $this->transformData($transformation, $relationshipName, $defaultRelationships);
} else {
$transformedData = null;
$transformedData = false;
}

if ($transformation->request->isIncludedField($resourceType, $relationshipName)) {
Expand All @@ -143,7 +143,7 @@ public function transform(
}

// DATA
if (isset($transformedData) === true) {
if ($transformedData !== false) {
$relationship["data"] = $transformedData;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/JsonApi/Schema/Relationship/ToManyRelationship.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected function transformData(
) {
$data = $this->retrieveData();
if (empty($data) || $this->resourceTransformer === null) {
return null;
return [];
}

$content = [];
Expand Down

0 comments on commit d4e9633

Please sign in to comment.