Skip to content
Advertisement

CollectionType elements missing data

I’ve embedded forms with CollectionType:

JavaScript

and ‘battlePages’ is an ArrayCollection with many elements.

JavaScript

But ‘$entity’ is empty however collection was walking through.

My goal would be to get BattlePage entity’s data in the ‘BattlePageCollectionType’ which is my second in examples ($entity).

Anybody had have similar issues?

Advertisement

Answer

The $builder->getData(); method doesn’t return an entity.

You should use Form Events

Example with PRE_SET_DATA event:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement