Public Member Functions | Protected Attributes

Robo47_Paginator_Adapter_DoctrineTable Class Reference

Inheritance diagram for Robo47_Paginator_Adapter_DoctrineTable:
Inheritance graph
[legend]
Collaboration diagram for Robo47_Paginator_Adapter_DoctrineTable:
Collaboration graph
[legend]

List of all members.

Public Member Functions

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

Protected Attributes

 $_query
 $_table

Detailed Description

Definition at line 33 of file DoctrineTable.php.


Constructor & Destructor Documentation

Robo47_Paginator_Adapter_DoctrineTable::__construct ( table  ) 
Parameters:
Doctrine_Table|string $table

Definition at line 50 of file DoctrineTable.php.

References setTable().

    {
        $this->setTable($table);
    }

Here is the call graph for this function:


Member Function Documentation

Robo47_Paginator_Adapter_DoctrineQuery::count (  )  [inherited]

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 
) [inherited]

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 (  )  [inherited]
Returns:
Doctrine_Query

Definition at line 66 of file DoctrineQuery.php.

    {
        return $this->_query;
    }

Robo47_Paginator_Adapter_DoctrineTable::getTable (  ) 
Returns:
Doctrine_Table

Definition at line 79 of file DoctrineTable.php.

Referenced by setTable().

    {
        return $this->_table;
    }

Here is the caller graph for this function:

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

Definition at line 56 of file DoctrineQuery.php.

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

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

Here is the caller graph for this function:

Robo47_Paginator_Adapter_DoctrineTable::setTable ( table  ) 

Set Table.

Parameters:
Doctrine_Table|string $table
Returns:
Robo47_Paginator_Adapter_DoctrineTable *Provides Fluent Interface*

Definition at line 61 of file DoctrineTable.php.

References getTable(), and Robo47_Paginator_Adapter_DoctrineQuery::setQuery().

Referenced by __construct().

    {
        if (is_string($table)) {
            $table = Doctrine_Core::getTable($table);
        }
        if (!$table instanceof Doctrine_Table) {
            $message = 'table not instance of Doctrine_Table.';
            throw new Robo47_Log_Writer_Exception($message);
        }
        $this->_table = $table;
        $this->setQuery($table->createQuery()->select());
        return $this;
    }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Robo47_Paginator_Adapter_DoctrineTable::$_query [protected]

Reimplemented from Robo47_Paginator_Adapter_DoctrineQuery.

Definition at line 40 of file DoctrineTable.php.

Robo47_Paginator_Adapter_DoctrineTable::$_table [protected]

Definition at line 44 of file DoctrineTable.php.


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