Controller/TaskController.php
public function typesAction(Request $request)
    {
        $component = $request->request->get('component');

        $taskTypes = $this->get('phlexible_task.types');

        $types = [];
        foreach ($taskTypes->all() as $type) {
            /* @var $type TypeInterface */
            if ($component && $type->getComponent() !== $component) {
                continue;
            }

            $types[] = [
                'id' => $type->getName(),
                'name' => $type->getName(),
            ];
        }

        return new JsonResponse(['types' => $types]);
    }
public function typesAction(Request $request)
    {
        $component = $request->request->get('component');

        $taskTypes = $this->get('phlexible_task.types');

        $types = [];
        foreach ($taskTypes->all() as $type) {
            /* @var $type TypeInterface */
            if ($component && $type->getComponent() !== $component) {
                continue;
            }

            $types[] = [
                'id' => $type->getName(),
                'name' => $type->getName(),
            ];
        }

        return new JsonResponse(['types' => $types]);
    }
public function typesAction ( Request $ request ) { $ component = $ request -> request -> get ( 'component' ) ; $ taskTypes = $ this -> get ( 'phlexible_task.types' ) ; $ types = [ ] ; foreach ( $ taskTypes -> all ( ) as $ type ) { /* @var $type TypeInterface */ if ( $ component && $ type -> getComponent ( ) !== $ component ) { continue ; } $ types [ ] = [ 'id' => $ type -> getName ( ) , 'name' => $ type -> getName ( ) , ] ; } return new JsonResponse ( [ 'types' => $ types ] ) ; }
List types.

@param Request $request

@return JsonResponse
@Route("/types", name="tasks_types")
@Method({"GET", "POST"})
@ApiDoc(
description="List task types",
filters={
{"name"="component", "dataType"="string", "description"="Component filter"}
}
)
List types .