private readonly ScriptLoader
$loader,
private readonly ScriptResponseEncoder
$scriptResponseEncoder ) { } #[Route(path: '/api/script/{hook}', name: 'api.script_endpoint', methods: ['POST'], requirements: ['hook' => '.+'])]
public function execute(string
$hook, Request
$request, Context
$context): Response
{ // blog/update => blog-update
$hook = \
str_replace('/', '-',
$hook);
$instance =
new ApiHook($hook,
$request->request->
all(),
$context);
$this->
validate($instance,
$context);
// hook: api-{hook}
$this->executor->
execute($instance);
$fields =
new ResponseFields( $request->
get('includes',
[]) );
return $this->scriptResponseEncoder->
encodeToSymfonyResponse(