toExtJs example

/** * Map result object to extjs array format * * @param ValidResult|FinishResult|ErrorResult $result * * @return array<string, bool|int|string> */
    private function mapResult($result): array
    {
        $mapper = new ExtJsResultMapper();

        return $mapper->toExtJs($result);
    }

    private function getUserLanguage(stdClass $user): string
    {
        $locale = $user->locale;
        $locale = strtolower($locale->getLocale());

        return substr($locale, 0, 2);
    }

    private function checkSecurityPlugin(): bool
    {
$this->response = $response;
        $this->container = $container;

        $this->resultMapper = new ResultMapper();
    }

    public function importSnippets()
    {
        $dump = $this->container->get('dump');
        if (!$dump) {
            $result = new FinishResult(0, 0);
            $this->toJson(200, $this->resultMapper->toExtJs($result));

            return;
        }

        $conn = $this->container->get('db');
        $snippetStep = new SnippetStep($conn$dump);

        $offset = $this->request->get('offset');
        $result = $snippetStep->run($offset);

        $this->toJson(200, $this->resultMapper->toExtJs($result));
    }
Home | Imprint | This part of the site doesn't use cookies.