How can I get data from my ArrayCollection?

I am trying to load data from my array collection via doctrine:

 $pages = $this->em->getRepository(Pages::class)->findAll();

The result is:

2 => Pages^ {#1598 ▼
-id: 3
-name: "cat"
-membergroup: PersistentCollection^ {#1603 ▼
  -snapshot: []
  -owner: Pages^ {#1598}
  -association: array:16 [ …16]
  -em: EntityManager^ {#278 …11}
  -backRefFieldName: "pages"
  -typeClass: ClassMetadata {#693 …}
  -isDirty: false
  #collection: ArrayCollection^ {#1604 ▼
    -elements: []
  }
  #initialized: false
}

}

The problem is, that I am expecting one element to be in the membergroup ArrayCollection. But it is empty.

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *