When receiving entities from the database, collections are received as PersistentCollection objects.
A PersistentCollectionmay not be initialized (i.e. its elements are not loaded), this is done via "_initialize()" when the elements are accessed for the first time (i.e. forAll() or the corresponding "foreach" call).
However when toArray() is called, the _initialize() call is missing, so the method may return an empty array even if the collection has elements.
Shouldn't PersistentCollection::toArray() look like this?