Apply sorting for Extbase ObjectStorage

I, andmanyothers, had the issue that it’s not possible to apply a default sorting for child objects of the type Tx_Extbase_Persistence_ObjectStorage with extbase. For exmpale, I happen to have a „course“ object which stores „event“ objects. The default getter would just

return $this->events;

without no possibility to define in what ordering the objects are returned.

Setting the default ordering in the event repository has no effects whatsoever. But the problem is actually pretty easy to solve. Just create an instance of the child object repository in the parent model and then you can use the default findBy methods. Lets say your parent object is called „Parent“ then you’d use findByParent($this->getUid());

In the child repository apply your sorting and do whatever you like:

Remove empty P tags before and after RTE content in Fluid Templates

I stubbled across this today on a clients page; I used f:format.html to pare some rte content. Somehow there where empty <p> tags before and after the content. At first I thought the RTE was at fault. But then I realized the problem was in my template;


The linebraeaks before and after the fluid variable ‚{rtecontent}‘ are responsible for the additional <p>’s. Conclusion: Don’t use linebreaks when you use <f:format.html>, instead use this: