phpro / zf-doctrine-hydration-module

Configurable Doctrine hydrators for ZF2
18 stars 33 forks source link

updates DoctrineObject to test for fieldMappings when preparing assoc… #26

Closed phpboyscout closed 8 years ago

phpboyscout commented 8 years ago

…iations

adds isset to metadata fieldMappings to allow for unidirectional mappings that do not generate metadata but are defined in the entity.

veewee commented 8 years ago

Thanks for contributing. I don't really know what problem this PR is fixing. Can you add a test case so it's clear what the code should do?

phpboyscout commented 8 years ago

Hi @veewee

Sorry I probably wasn't very clear in my commit message. In certain situations I've found that when implementing a unidirectional relationship, the inversed side of the relationship doesn't have metadata available about the relationship. All this PR does is add a simple isset check for the metadata available in the field mappings for the association. The main reason for this is that if the metadata doesnt exist you get a E_NOTICE about an undefined index... which as I'm sure you can appreciate would really quickly fill out any log files if your tracking notices. By adding the isset it guards against this and also prevents execution of code when no metadata is available,

Matt

veewee commented 8 years ago

Thanks! I added some additional comments to the code so that I remember why that lines are added. The changes are also tagged as : 0.1.6 https://github.com/phpro/zf-doctrine-hydration-module/releases/tag/0.1.6