getSingleResult example

$category['urlParams'] = [
                'sViewport' => 'cat',
                'sCategory' => $category['id'],
                'title' => $category['name'],
            ];

            if ($category['blog']) {
                $category['urlParams']['sViewport'] = 'blog';
            }
        }

        $parentCategory = $categoryRepository->getDetailQuery($parentId)->getSingleResult(AbstractQuery::HYDRATE_ARRAY);

        // Add home page         array_unshift($categories[
            'id' => $parentCategory['id'],
            'changed' => $parentCategory['changed'],
            'urlParams' => [
                'sViewport' => 'index',
            ],
        ]);

        unset($category);

        
protected function getArticleConfiguratorSet($articleId)
    {
        $builder = $this->getManager()->createQueryBuilder();
        $builder->select(['configuratorSet', 'groups'])
            ->from(Set::class, 'configuratorSet')
            ->innerJoin('configuratorSet.articles', 'article')
            ->leftJoin('configuratorSet.groups', 'groups')
            ->addOrderBy('groups.position', 'ASC')
            ->where('article.id = :articleId')
            ->setParameter(':articleId', $articleId);

        return $this->getSingleResult($builder);
    }

    /** * Selects all images of the main variant of the passed product id. * The images are sorted by their position value. * * @param int $articleId * * @return array<array<string, mixed>> */
    protected function getArticleImages($articleId)
    {
'success' => false,
            ]);

            return;
        }

        $previewData = $this->container->get(ModelManager::class)->getRepository(Preset::class)->createQueryBuilder('preset')
            ->select('preset.presetData, preset.preview')
            ->where('preset.id = :id')
            ->setParameter('id', $id)
            ->getQuery()
            ->getSingleResult(Query::HYDRATE_ARRAY);

        $previewData['previewUrl'] = $this->getImagePath($previewData['preview']);

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

    /** * @throws Enlight_Controller_Exception * * @return void */

            ->from(Emotion::class, 'emotion')
            ->leftJoin('emotion.elements', 'elements')
            ->leftJoin('elements.viewports', 'viewports')
            ->leftJoin('elements.component', 'component')
            ->leftJoin('component.fields', 'fields')
            ->leftJoin('elements.data', 'data')
            ->where('emotion.id = :emotionId')
            ->orderBy('elements.id')
            ->setParameter('emotionId', $emotionId)
            ->getQuery()
            ->getSingleResult(Query::HYDRATE_ARRAY);
    }

    /** * @param bool $keepName * * @return array */
    private function cleanupEmotionData(array $emotionData$keepName = false)
    {
        unset(
            $emotionData['parentId'],
            

    public function getOneByUser($addressId$userId)
    {
        $builder = $this->getDetailQueryBuilder($addressId);

        return $builder
            ->andWhere('IDENTITY(address.customer) = :userId')
            ->setParameter('userId', $userId)
            ->getQuery()
            ->getSingleResult();
    }

    /** * Helper method to create the query builder for the "getUserBillingQuery" function. * This function can be hooked to modify the query builder of the query object. * * @param int $userId * * @return QueryBuilder */
    protected function getByUserQueryBuilder($userId)
    {
Home | Imprint | This part of the site doesn't use cookies.