Skip to content

Loading…

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

Closed
doctrinebot opened this Issue · 4 comments

1 participant

@doctrinebot

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"; } ... }

Output:
0
1

@doctrinebot

Comment created by romanb:

Should be fixed now.

@doctrinebot

Issue was closed with resolution "Fixed"

@doctrinebot

Comment created by cloun:

Thanks

@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.