You are correct: when the reference doesn't change, Doctrine won't see it as a 
change. You can't solve this from within the custom type, as it won't be 
reached. You'll have to make sure the reference in your entity changes.

The object you are using sounds like a Value Object [1] [2]. I'd advise you to 
make Value Objects immutable, meaning they cannot be changed. That will force 
you to create a new object and set it on the entity. The reference is therefor 
changed and Doctrine will pick it up nicely.

[1]: http://en.wikipedia.org/wiki/Value_object
[2]: http://martinfowler.com/bliki/ValueObject.html

--  
Jasper N. Brouwer
(@jaspernbrouwer)


On 2 December 2014 at 09:48:03, Arnaud Lepeltier ([email protected]) wrote:
> I created a Custom Doctrine Type :
> The "convertToPHPValue" return an object of my own class.
> The probleme is that when I flush, nothing is updated in the database.
> I suppose the probleme is the same that with the Datetime: Changes are
> detected by reference on my object.
> http://doctrine-orm.readthedocs.org/en/latest/cookbook/working-with-datetime.html.
>   
>  
> I can resolve that with a few code in the setter or getter method, but
> isn't there a better way?


-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to