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

Closed
doctrinebot opened this Issue Jan 3, 2010 · 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 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