You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note that no type is specified in the virtual_properties configuration for getSomeObject. I expect the JMSSerializer to infer the type (SomeType) using the return value of getSomeObject.
The issue is : why should a doctrine type driver be used in case of a virtual property ? I can work around this issue renaming the property to something funny :
classSomeEntity {
/** * This property has a funny name because JMSSerializer has a funny behavior * * @Column(type="blob") */protected$someObjectTotoFooBarFunnyNameHuh;
/** * @return SomeType */publicfunctiongetSomeObject()
{
// ... unserialize $this->someObjectTotoFooBarFunnyNameHuh to $unserializedObject/** @var SomeType $unserializedObject */return$unserializedObject
}
}
Did I missed something or is it pure nonsense ?
The text was updated successfully, but these errors were encountered:
Say I have a doctrine entity
And the following Serializer configuration :
Note that no
type
is specified in thevirtual_properties
configuration forgetSomeObject
. I expect the JMSSerializer to infer the type (SomeType
) using the return value ofgetSomeObject
.But this is not happening. Instead, even if it is a virtual property, it fetches the type from Doctrine metadata of the property having a related name (
$someObject
) and cast is as astring
becauseblob
is considered string by the DoctrineDriver. See https://github.com/schmittjoh/serializer/blob/master/src/JMS/Serializer/Metadata/Driver/DoctrineTypeDriver.php#L47.The issue is : why should a doctrine type driver be used in case of a virtual property ? I can work around this issue renaming the property to something funny :
Did I missed something or is it pure nonsense ?
The text was updated successfully, but these errors were encountered: