Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #324 from RTLer/Hotfix/NullResource
Fix when nullResource returned from Transformers
- Loading branch information
Showing
4 changed files
with
86 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
|
||
namespace League\Fractal\Test\Stub; | ||
|
||
use League\Fractal\Serializer\ArraySerializer; | ||
|
||
class ArraySerializerWithNull extends ArraySerializer | ||
{ | ||
/** | ||
* Serialize null resource. | ||
* | ||
* @return null | ||
*/ | ||
public function null() | ||
{ | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php namespace League\Fractal\Test\Stub\Transformer; | ||
|
||
use League\Fractal\TransformerAbstract; | ||
|
||
class NullIncludeBookTransformer extends TransformerAbstract | ||
{ | ||
protected $defaultIncludes = [ | ||
'author', | ||
]; | ||
|
||
public function transform() | ||
{ | ||
return ['a' => 'b']; | ||
} | ||
|
||
public function includeAuthor() | ||
{ | ||
return $this->null(); | ||
} | ||
} |