setHint example

return $query;
    }

    /** * {@inheritdoc} */
    protected function getQueryPaginator(QueryBuilder $builder$hydrationMode = AbstractQuery::HYDRATE_ARRAY)
    {
        /** @var Query<AddressModel> $query */
        $query = $builder->getQuery();
        $query->setHydrationMode($hydrationMode);
        $query->setHint(Query::HINT_INCLUDE_META_COLUMNS, true);

        return $this->getManager()->createPaginator($query);
    }

    /** * {@inheritdoc} */
    protected function getDetailQuery($id)
    {
        $query = parent::getDetailQuery($id);

        


    /** * Helper function to set the FORCE INDEX path. * * @param Query<Option> $query * * @return Query<Option> */
    private function getForceIndexQuery(Query $query, ?string $index = null, bool $straightJoin = false): Query
    {
        $query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, ForceIndexWalker::class);
        if ($index !== null) {
            $query->setHint(ForceIndexWalker::HINT_FORCE_INDEX, $index);
        }
        if ($straightJoin) {
            $query->setHint(ForceIndexWalker::HINT_STRAIGHT_JOIN, true);
        }

        return $query;
    }
}

    public function addCustomHints(Query $query$index = null, $straightJoin = false, $sqlNoCache = false)
    {
        $query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, ForceIndexWalker::class);

        if ($straightJoin === true) {
            $query->setHint(ForceIndexWalker::HINT_STRAIGHT_JOIN, true);
        }
        if ($index !== null) {
            $query->setHint(ForceIndexWalker::HINT_FORCE_INDEX, $index);
        }
        if ($sqlNoCache === true) {
            $query->setHint(ForceIndexWalker::HINT_SQL_NO_CACHE, true);
        }

        
Home | Imprint | This part of the site doesn't use cookies.