ensureElement example

// By calling preExecute() here, we force it to preprocess the extender     // object rather than just the base query object. That means     // hook_query_alter() gets access to the extended object.     if (!$this->preExecute($this)) {
      return NULL;
    }

    // A NULL limit is the "kill switch" for pager queries.     if (empty($this->limit)) {
      return;
    }
    $this->ensureElement();

    $total_items = $this->getCountQuery()->execute()->fetchField();
    $pager = $this->connection->getPagerManager()->createPager($total_items$this->limit, $this->element);
    $this->range($pager->getCurrentPage() * $this->limit, $this->limit);

    // Now that we've added our pager-based range instructions, run the query normally.     return $this->query->execute();
  }

  /** * Ensure that there is an element associated with this query. * * After running this method, access $this->element to get the element for this * query. */
Home | Imprint | This part of the site doesn't use cookies.