phpro / zf-doctrine-hydration-module

Configurable Doctrine hydrators for ZF2
18 stars 33 forks source link

Reference hydration assumes document exists #21

Open Bilge opened 8 years ago

Bilge commented 8 years ago

When hydrating referenced documents the current logic assumes that an identifier will be passed and that a document with that identifier already exists. This may not be the case, however, and in the event that no identifier is passed it should be possible to instantiate a new document in lieu of an existing one.

veewee commented 8 years ago

This can be fixed by adding a custom strategy. Personally I have never encountered a situation where I wanted to create a referenced resource at the same time as attaching it to another entity. If this is something that is required frequently, it can be added as a default strategy to this repository.

veewee commented 8 years ago

The failing tests are due to: https://github.com/phpro/zf-doctrine-hydration-module/issues/20