Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AccessType("public_method"): Setters ignored when deserializing to non-standard XML properties #53

Closed
robhogan opened this issue Mar 5, 2013 · 1 comment

Comments

@robhogan
Copy link

robhogan commented Mar 5, 2013

XmlDeserializationVisitor::visitProperty uses reflection to set properties unless none of xmlAttribute, xmlValue, xmlCollection are set. For any remaining properties, reflection will only be used if metadata->setter is null. The latter logic seems more desirable for all cases.

This is presumably a bug? I can't see any reason the following configuration should not be using setItems when deserializing from XML:

class Order {
    /**
     * @Type("ArrayCollection<Item>")
     * @XmlList(entry = "item", inline = true)
     * @AccessType("public_method")
     */
    private $items;

    public function setItems($items){
        $this->items = $items;
        //Do something else
    }
}

I ran into this when attempting to make sure my Items were aware of my Orders, as Item was the owner of a Doctrine association.

@robhogan
Copy link
Author

robhogan commented Mar 5, 2013

Closing this issue - have raised a new one with test attached.

@robhogan robhogan closed this as completed Mar 5, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant