graze / dal

Data Access Layer
MIT License
8 stars 0 forks source link

Ensure entity collection properties have a good default #15

Closed sjparkinson closed 9 years ago

sjparkinson commented 9 years ago

This change ensures the _elements property of ArrayCollection is set to an empty array by default.

Then calls to methods like contains don't explode when you're working with an empty collection property.

All credit to @wpillar for the fix.

h-bragg commented 9 years ago

Would this also enable using {{ if collection }} in twig and returning false when its empty?

sjparkinson commented 9 years ago

Would this also enable using {{ if collection }} in twig and returning false when its empty?

I'm not sure it would, worth an experiment.