Public Member Functions | Protected Attributes

Robo47_Paginator_Adapter_DoctrineQuery Class Reference

Inheritance diagram for Robo47_Paginator_Adapter_DoctrineQuery:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 __construct (Doctrine_Query $query)
 count ()
 Returns the total number of rows in the collection.
 getItems ($offset, $itemCountPerPage)
 Returns an collection of items for a page.
 getQuery ()
 setQuery (Doctrine_Query $query)

Protected Attributes

 $_query

Detailed Description

Definition at line 33 of file DoctrineQuery.php.


Constructor & Destructor Documentation

Robo47_Paginator_Adapter_DoctrineQuery::__construct ( Doctrine_Query $  query  ) 
Parameters:
Doctrine_Query $query

Definition at line 46 of file DoctrineQuery.php.

References setQuery().

    {
        $this->setQuery($query);
    }

Here is the call graph for this function:


Member Function Documentation

Robo47_Paginator_Adapter_DoctrineQuery::count (  ) 

Returns the total number of rows in the collection.

Implements SPL::Countable::count()

Returns:
integer

Definition at line 78 of file DoctrineQuery.php.

    {
        return $this->_query->count();
    }

Robo47_Paginator_Adapter_DoctrineQuery::getItems ( offset,
itemCountPerPage 
)

Returns an collection of items for a page.

Parameters:
integer $offset Page offset
integer $itemCountPerPage Number of items per page
Returns:
array

Definition at line 90 of file DoctrineQuery.php.

References Robo47_Core::getType().

    {
        $data = $this->_query
            ->limit($itemCountPerPage)
            ->offset($offset)
            ->execute();
        if ($data instanceof Doctrine_Collection) {
            return $data->getData();
        } elseif(is_array($data)) {
            return $data;
        } else {
            $message = 'Unexpected datatype for getItems(): ' .
                Robo47_Core::getType($data);
            throw new Robo47_Paginator_Adapter_Exception($message);
        }
    }

Here is the call graph for this function:

Robo47_Paginator_Adapter_DoctrineQuery::getQuery (  ) 
Returns:
Doctrine_Query

Definition at line 66 of file DoctrineQuery.php.

    {
        return $this->_query;
    }

Robo47_Paginator_Adapter_DoctrineQuery::setQuery ( Doctrine_Query $  query  ) 
Parameters:
Doctrine_Query $query
Returns:
Robo47_Paginator_Adapter_DoctrineQuery *Provides Fluent Interface*

Definition at line 56 of file DoctrineQuery.php.

Referenced by __construct(), and Robo47_Paginator_Adapter_DoctrineTable::setTable().

    {
        $this->_query = $query;
        return $this;
    }

Here is the caller graph for this function:


Member Data Documentation

Robo47_Paginator_Adapter_DoctrineQuery::$_query [protected]

Reimplemented in Robo47_Paginator_Adapter_DoctrineTable.

Definition at line 40 of file DoctrineQuery.php.


The documentation for this class was generated from the following file: