getSnippetsForLocales example


        $builder->addOrderBy($sort);

        $builder->setFirstResult($this->Request()->getParam('start'))
            ->setMaxResults($this->Request()->getParam('limit'));

        $query = $builder->getQuery();

        $total = $this->get(ModelManager::class)->getQueryCount($query);
        $data = $query->getArrayResult();

        $data = $this->getSnippetsForLocales($data);

        $this->View()->assign(['success' => true, 'data' => $data, 'total' => $total]);
    }

    public function getCountryAreasAction()
    {
        $repository = $this->get('models')->getRepository(Area::class);

        /** @var QueryBuilder $builder */
        $builder = $repository->createQueryBuilder('area');
        $builder->select([
            
$builder->addFilter((array) $this->Request()->getParam('filter', []))
            ->addOrderBy((array) $this->Request()->getParam('sort', []));
        $builder->setFirstResult($this->Request()->getParam('start'))
            ->setMaxResults($this->Request()->getParam('limit'));

        $query = $builder->getQuery();
        $total = $this->get('models')->getQueryCount($query);
        $data = $query->getArrayResult();

        if (!empty($data) && $name === 'locale') {
            $data = $this->getSnippetsForLocales($data);
        }

        if ($name === 'document') {
            // Translate document type             // The standard $translationComponent->translateDocuments can not be used here since the             // name may not be overridden. The field is edible and if the translation is             // shown in the edit field, there is a high chance of a user saving the translation as name             $translator = $this->get('translation')->getObjectTranslator('documents');

            $data = array_map(static function D$document) use ($translator) {
                return $translator->translateObjectProperty($document, 'name', 'description', $document['name']);
            },
Home | Imprint | This part of the site doesn't use cookies.