Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transformers defaultInclude not working #24

Closed
devmark opened this issue Apr 19, 2015 · 1 comment
Closed

transformers defaultInclude not working #24

devmark opened this issue Apr 19, 2015 · 1 comment

Comments

@devmark
Copy link

devmark commented Apr 19, 2015

class BookTransformer extends TransformerAbstract
{
    protected $defaultIncludes = [
        'author'
    ];
   ...
    public function includeAuthor(Book $book)
    {
        $author = $book->author;

        return $this->item($author, new AuthorTransformer);
    }
}
  • already using with(['author'])
  • $book->author will return null
@devmark devmark closed this as completed Apr 20, 2015
@jonagoldman
Copy link

Hey @devmark I am trying to do a similar thing. I basically want to decide when to transform relationships. Would appreciate if you can give me a hint.

Please take a loot at the issue I opened here: #101

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants