B
B
BonBon Slick2019-01-18 18:52:41
symfony
BonBon Slick, 2019-01-18 18:52:41

Custom field serialization method?

Something like
https://symfony.com/doc/current/components/seriali...

/**
     * @SerializedName("customer_name")
     */
    private $firstName;

But for the method that is used for the serializer.
The task is such, there is a field connection with an object, if serialization is in progress, it must be returned boolean and not a connection.
Having rummaged in the package and the docks, I did not find how to register a custom method. I know that in JMS Serializer there is such.
For now, I use a custom normalizer to convert the connection to a boolean, and then again a serializer, which is very expensive.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question