Closed Estigy closed 8 years ago
And is there a way to do some kind of dynamic mapping, meaning that in one case I want to output a User entity with all its Comments, and in another case I don't want to include the Comments. For the alternate Comments section it is easy, you'll need to create another class.
Lets say, you have the Posts
model. I'm assuming you've got relations set up to a Comments
model.
If you want one without the Comments, all you need to do is:
<?php
class PostsWithoutComments extends Posts
{
}
And then:
PostsWithoutComments
model. PostsWithoutComments
as you would use Posts
.
Hi, Nil.
Is there a way to add Relationships without adding the whole Entity to the "include" block?
And is there a way to do some kind of dynamic mapping, meaning that in one case I want to output a User entity with all its Comments, and in another case I don't want to include the Comments.
Thanks! Estigy.