DDC-238: PersistentCollection is not initialized when toArray() is called #3089

doctrinebot opened this Issue Jan 5, 2010 · 4 comments

1 participant


Jira issue originally created by user nicokaiser:

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?

    public function toArray()
        return $this->_coll->toArray();

Comment created by romanb:

Right, we got this reported two times already (this is the third) so I guess I better go fix this now ;)


Comment created by romanb:

Should be fixed now.


Issue was closed with resolution "Fixed"

@doctrinebot doctrinebot added this to the 2.0-ALPHA4 milestone Dec 6, 2015
@doctrinebot doctrinebot closed this Dec 6, 2015
@doctrinebot doctrinebot added the Bug label Dec 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment