Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
448 views
in Technique[技术] by (71.8m points)

symfony - Decorate SerializerFilterContextBuilder in order to customisze request

My frontend send exotic data in query and I can't change this

pagination%5Bpage%5D: 1
pagination%5Bpages%5D: 2
pagination%5Bperpage%5D: 20
pagination%5Btotal%5D: 30
sort%5Bfield%5D: name
sort%5Bsort%5D: desc

I wan't to modify request for pagination, sort and filter in order to respect the api-platform convention.

I think I can change the request in the class ApiPlatformCoreSerializerSerializerContextBuilder

So I configure in services.yaml a decorator for this class

ApiPlatformCoreSerializerSerializerContextBuilder: ~

AppDecoratorSerializerContextBuilder:
    decorates: ApiPlatformCoreSerializerSerializerContextBuilder
    arguments: ['@.inner']

I add a dump in my class and the decorated class but I can't see the dump of my class.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...