Make allowObjectBinding configurable for Fieldsets #5741

merged 14 commits into from Mar 7, 2014


None yet
2 participants

veewee commented Jan 23, 2014

While working on a module with form annotations, I bumped into a problem:

  • I created a ComposedObject annotation with is_collection= false (so a Fieldset).
  • Next I added a Hydrator annotation for this fieldset only.
  • The fieldset did not get populated with the attached object.

This is because there is no object attached to the fieldset yet while binding a new object.
Therefor, it should be configurable which objects are allowed and which not.

This commit will make it possible to use

     * @Form\ComposedObject({"target_object": "Application\Entity\Connection", "is_collection": false, "options": {
     *  "use_as_base_fieldset": false,
     *  "allowed_object_binding_class": "Application\Entity\Connection"
     * }});
     * @Form\Flags({"priority": 960})
     * @Form\Hydrator("Application\Hydrator\Connection")
     * @var \Application\Entity\Connection
    protected $connection;

When an object is bound to the form, the getConnection() will return a Application\Entity\Connection instance. Therefore the custom hydrator will be used and the form will work as suspected.


veewee commented Feb 27, 2014

bump: Any comments / progress?

(Travis won't pass because of failed dependencies in composer. Tests should work fine!)

weierophinney added this to the 2.3.0 milestone Mar 3, 2014


weierophinney commented Mar 4, 2014

@veewee I'm planning to merge this against develop for 2.3.0. However, it does not cleanly merge currently due to other pull requests I've merged in the last few days. It's possible one or more of these may solve the same problem; at the very least, changes conflict.

Can you do the following please?

  • Rebase your branch against current develop branch, and fix any merge conflicts
  • Re-submit this PR against the develop branch; ping me via a comment
  • Close this PR, and reference the new one when you do



veewee commented Mar 7, 2014

ping @weierophinney
My branch is rebased against current develop branch. Added a small fix to.
I'm not able to re-submit this PR, because this PR is allready opened. Is it okay to go on from this PR?

weierophinney self-assigned this Mar 7, 2014

@weierophinney weierophinney added a commit that referenced this pull request Mar 7, 2014

@weierophinney weierophinney Merge branch 'hotfix/5741' into develop
Close #5741

weierophinney merged commit d4743bd into zendframework:develop Mar 7, 2014

1 check passed

default The Travis CI build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment