Skip to content

[2.0.1] Unexpected behavior in transformer #165

Answered by rubenvanassche
alexrififi asked this question in Q&A
Discussion options

You must be logged in to vote

Partials trees which power the only directive only get passed on top -> down.

So the collection has no partial trees, and this gets passed on to the individual data objects.

In the second example, no Collectable transformer is used an for each data object a partials tree is constructed which will include the only directive.

This approach we once started when the package was first built, since you probably want to decide includes, excludes, only's and except's at the point where you're sending out the data. Maybe that approach should change although I'm not sure how performant it will be.

As for your example, this seems a far better solution to me:

    public function transform(DataProperty $

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by alexrififi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants