protected function setLimitOrder(QueryBuilder $query, array $options)
    {
        if (isset($options['order'])) {
            $query->orderBy($options['order'], isset($options['direction']) ? $options['direction'] : null);
        }
        if (isset($options['limit'])) {
            $query->setMaxResults((int) ($options['limit']));

            if (isset($options['offset'])) {
                $query->setFirstResult((int) ($options['offset']));
            }
        }
    }