Skip to content


DDC-232: toArray of PersistentCollection returns an empty collection #3024

doctrinebot opened this Issue · 4 comments

1 participant


Jira issue originally created by user cloun:

I've found little error in the class Doctrine\ORM\PersistentCollection in method toArray. There is lost calling of _initialize method probably. This leads to abnormal behavior:

class Role

  • @ManyToMany(targetEntity="Resource")
  • @JoinTable(name="access",
  • joinColumns={@JoinColumn(name="roleid", referencedColumnName="roleid")},
  • inverseJoinColumns={@JoinColumn(name="resourceid", referencedColumnName="resourceid")}
  • ) */ private $resources; public function makeTest() { echo count($this->resources->toArray()) . "\n"; echo count($this->resources) . "\n"; } ... }



Comment created by romanb:

Should be fixed now.


Issue was closed with resolution "Fixed"


Comment created by cloun:


@doctrinebot doctrinebot added this to the 2.0-ALPHA4 milestone
@doctrinebot doctrinebot closed this
@doctrinebot doctrinebot added the Bug label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.