Makes the correct Action object based on the request.

@param Request $request
@return Action
14473
public static function factory(Request $request)
    {
        /** @var Action[] $actions */
        $actions = self::getAllActions($request);

        foreach ($actions as $actionType) {
            if (empty($action)) {
                $action = $actionType;
                continue;
            }

            $posPrevious = self::getPriority($action);
            $posCurrent  = self::getPriority($actionType);

            if ($posCurrent > $posPrevious) {
                $action = $actionType;
            }
        }

        if (!empty($action)) {
            return $action;
        }

        return new ActionPageview($request);
    }
1024166
function handleActionOrID($request)
    {
        if (is_numeric($request->param('Action'))) {
            $controller = $this->config()->recordController;
            return new $controller($this, $this->getRecordType(), $request);
        } else {
            return $this->handleAction($request, null);
        }
    }
11455
public function createAction(Request $request)
    {
        $manager = $this->get('opifer.redirect.redirect_manager');

        $redirect = $manager->createNew();

        $form = $this->createForm(RedirectType::class, $redirect);
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {

            $manager->save($redirect);
            $this->addFlash('success', $this->get('translator')->trans('opifer_redirect.flash.created'));

            if ($form->get('saveAndAdd')->isClicked()){
                return $this->redirectToRoute('opifer_redirect_redirect_create');
            }

            return $this->redirectToRoute('opifer_redirect_redirect_edit', ['id' => $redirect->getId()]);
        }

        return $this->render($this->container->getParameter('opifer_redirect.redirect_create_view'), [
            'form' => $form->createView(),
        ]);
    }
960992
public function handle(Request $request)
    {
        $this->currentUri = $request->fullUrl();

        $this->response = $this->app->prepareResponse($this->app->handle($request));

        return $this;
    }
323734
public function createAction(Request $request)
    {
        $contentEntityClass = $this->configurationManager->getEntityClass('content');
        $content = new $contentEntityClass;

        $form = $this->createForm(ContentCreateType::class, $content, [
            'action' => $this->generateUrl('sherlockode_acb_content_create'),
        ]);

        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $this->om->persist($content);
            $this->om->flush();

            return $this->redirectToRoute('sherlockode_acb_content_edit', ['id' => $content->getId()]);
        }

        return $this->render('@SherlockodeAdvancedContent/Content/create_content.html.twig', [
            'form' => $form->createView(),
            'data' => $content,
        ]);
    }
648650
public function toggleAction(Request $request)
    {
        $context = $this->loadContext($request);

        $resource = $context->getResource();

        $this->isGranted('EDIT', $resource);

        if (null !== $field = $request->attributes->get('field')) {
            $accessor = PropertyAccess::createPropertyAccessor();
            $value = $accessor->getValue($resource, $field);
            $accessor->setValue($resource, $field, !$value);

            // TODO use ResourceManager
            $event = $this->getOperator()->update($resource);
            $event->toFlashes($this->getFlashBag());
        }

        // TODO Redirect to parent show

        return $this->redirectToReferer($this->generateUrl(
            $this->config->getRoute('list'),
            $context->getIdentifiers()
        ));
    }
105820
public function indexAction(Request $request)
    {
        return $this->processView($action = 'index', $this->view($this->find($action, false)));
    }
1000825
public function setAction(Request $request)
    {
        $ids = $request->get('ids');
        $ids = explode(',', $ids);

        $metaSetManager = $this->get('phlexible_meta_set.meta_set_manager');
        $metaSets = [];
        foreach ($ids as $id) {
            $metaSets[] = $metaSetManager->find($id);
        }

        $config = $this->createMetasetConfig($metaSets);

        return new JsonResponse($config);
    }
893484
protected function handleAction($request, $action)
    {
        $classMessage = Director::isLive() ? 'on this handler' : 'on class ' . static::class;

        if (!$this->hasMethod($action)) {
            return new HTTPResponse("Action '$action' isn't available $classMessage.", 404);
        }

        $res = $this->extend('beforeCallActionHandler', $request, $action);
        if ($res) {
            return reset($res);
        }

        $actionRes = $this->$action($request);

        $res = $this->extend('afterCallActionHandler', $request, $action, $actionRes);
        if ($res) {
            return reset($res);
        }

        return $actionRes;
    }
234684
public function addAction(Request $request)
    {
        $resource = $this->mapper->create($this->validateRequestParameters($request));

        return new Response('', 201, array('Location' => $this->mapper->generateReadUrl($resource)));
    }
836068
public function moveUpAction(Request $request)
    {
        $context = $this->loadContext($request);

        $resource = $context->getResource();

        $this->isGranted('EDIT', $resource);

        $repo = $this->getRepository();
        $repo->moveUp($resource, 1);

        return $this->redirectToReferer($this->generateUrl(
            $this->config->getRoute('list'),
            $context->getIdentifiers()
        ));
    }
1323211
public function moveAction(Request $request)
    {
        $admin = $this->getAdmin();

        $admin->checkAccess('edit');

        if ($this->admin->isChild()) {
            $id = $request->query->get('childId');
        } else {
            $id = $request->query->get('id');
        }

        $targetId = $request->query->get('target');
        $dropPosition = $request->query->get('position');

        $em = $this->getDoctrine()->getManager();

        /** @var NestedTreeRepository $repo */
        $repo = $em->getRepository($admin->getClass());

        $currentNode = $repo->find($id);
        $targetNode = $repo->find($targetId);

        switch ($dropPosition) {
            case 'before':
                $repo->persistAsPrevSiblingOf($currentNode, $targetNode);
                break;
            case 'after':
                $repo->persistAsNextSiblingOf($currentNode, $targetNode);
                /*
                                    if ($currentNode->getLft() < $targetNode->getLft() ) {
                                        $repo->persistAsNextSiblingOf($currentNode, $targetNode);

                                    } else {
                                        $repo->persistAsNextSiblingOf($targetNode, $currentNode);
                                    }
                */
                break;
            case 'append':
                $repo->persistAsLastChildOf($currentNode, $targetNode);
                break;
        }

        $admin->update($currentNode);
        $admin->update($targetNode);

        $response = new Response(json_encode(['result' => true]), 200);

        $response->headers->set('Content-Type', 'application/json');

        return $response;
    }
1231436
public function createAction(Request $request)
    {
        $entity  = new Tag();
        $form = $this->createForm(new TagType(), $entity);
        $form->bind($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($entity);
            $em->flush();

            $this->getSession()->getFlashBag()->set('success', 'The tag has been created successfully.');

            return $this->redirect($this->generateUrl('manage_tags'));
        }

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }
347723
public function allAction(Request $request)
    {
        $model = $this->getModel();

        $content = $this->restUtils->serialize($model->findAll($request));

        $response = $this->getResponse()
            ->setStatusCode(Response::HTTP_OK)
            ->setContent($content);

        return $response;
    }
650695
public function createAction(Request $request)
    {
        $this->denyAccessUnlessGranted('ROLE_ADMIN');

        $domain = new Domain();

        $form = $this->createForm(DomainType::class, $domain);
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($domain);
            $em->flush();

            $this->addFlash('success', 'Domaim has been created successfully');

            return $this->redirectToRoute('opifer_cms_domain_edit', ['id' => $domain->getId()]);
        }

        return $this->render('OpiferCmsBundle:Backend/Domain:create.html.twig', [
            'domain' => $domain,
            'form' => $form->createView()
        ]);
    }
211225
public function run(Request $request) {
    // process the requested action
    ObjectFactory::getInstance('actionMapper')->processAction($request, $this->response);
    return $this->response;
  }
1355954
public function editAction(Request $request)
    {
        $container = $this->findContainerByRequest($request);

        try {
            $response = $this->getEditor()->getContainerManager()->update($container, $request);
        } catch (EditorExceptionInterface $e) {
            return $this->handleException($e);
        }

        if ($response instanceof Modal) {
            return $this->renderModal($response);
        } elseif ($response instanceof Response) {
            return $response;
        }

        $this->validate($container);
        $this->persist($container);

        $data = [
            'containers' => [$this->getViewBuilder()->buildContainer($container)],
        ];

        return $this->buildResponse($data, self::SERIALIZE_FULL);
    }