getBackendDetailQuery example

$params['media'] = $this->prepareMediaDataForSaving($params['media']);

        $blogModel->fromArray($params);

        try {
            $this->getManager()->persist($blogModel);
            $this->getManager()->flush();

            $repository = $this->getManager()->getRepository(Blog::class);

            $filter = [['property' => 'id', 'value' => $blogModel->getId()]];
            $dataQuery = $repository->getBackendDetailQuery($filter);
            $data = $dataQuery->getOneOrNullResult(AbstractQuery::HYDRATE_ARRAY);
            $this->View()->assign(['success' => true, 'data' => $data]);
        } catch (Exception $e) {
            $this->View()->assign(['success' => false, 'message' => $e->getMessage()]);
        }
    }

    /** * returns a JSON string to show all blog detail information */
    public function getDetailAction()
    {
/** * Gets all category detail information by the category node */
    public function getDetailAction()
    {
        $node = $this->Request()->getParam('node', 1);
        if ($node !== null) {
            $node = is_numeric($node) ? (int) $node : 1;
            $filter[] = ['property' => 'c.parentId', 'value' => $node];
        }
        /** @var Query<array<string, mixed>> $query */
        $query = $this->getRepository()->getBackendDetailQuery($node)->getQuery();
        $query->setHydrationMode(AbstractQuery::HYDRATE_ARRAY);
        $paginator = $this->getModelManager()->createPaginator($query);
        $data = iterator_to_array($paginator);
        $data = $data[0];

        $data['imagePath'] = $data['media']['id'] ?? null;

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

    /** * Returns the whole category path by an category id */
Home | Imprint | This part of the site doesn't use cookies.