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

Commit

Permalink
Allow relationship to be null
Browse files Browse the repository at this point in the history
  • Loading branch information
tobyzerner committed Oct 30, 2015
1 parent 78bc6e1 commit 78f02bd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/AbstractSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public function getRelationship($model, $name)
if (method_exists($this, $name)) {
$relationship = $this->$name($model);

if (! ($relationship instanceof Relationship)) {
throw new LogicException('Relationship method must return an instance of '
if ($relationship !== null && ! ($relationship instanceof Relationship)) {
throw new LogicException('Relationship method must return null or an instance of '
.Relationship::class);
}

Expand Down

0 comments on commit 78f02bd

Please sign in to comment.