How can I fix a deprecated user in Symfony 4?
问题 I get the following error message: User Deprecated: Passing configuration options directly to the constructor is deprecated since Symfony 4.2, use the default context instead. This is the code Symfony is giving as trace for the problem: $serializer = new Serializer(array(new DateTimeNormalizer('d.m.Y'), new GetSetMethodNormalizer()), array('json' => new JsonEncoder())); But I do not understand how to use a default context 回答1: You have to use directly the service. class DefaultController