Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Make allowObjectBinding configurable for Fieldsets #5741

Merged

Conversation

veewee
Copy link
Contributor

@veewee 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
Copy link
Contributor Author

veewee commented Feb 27, 2014

bump: Any comments / progress?

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

@weierophinney weierophinney added this to the 2.3.0 milestone Mar 3, 2014
@weierophinney
Copy link
Member

@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

Thanks!

@veewee
Copy link
Contributor Author

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 weierophinney self-assigned this Mar 7, 2014
weierophinney added a commit that referenced this pull request Mar 7, 2014
Make allowObjectBinding configurable for Fieldsets
weierophinney added a commit that referenced this pull request Mar 7, 2014
@weierophinney weierophinney merged commit d4743bd into zendframework:develop Mar 7, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants