Public Member Functions | Static Public Member Functions | Protected Attributes

Robo47_Log_Writer_DoctrineTable Class Reference

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

List of all members.

Public Member Functions

 __construct ($table, array $columnMap=array())
 _write ($event)
 Write Event to database.
 getColumnMap ()
 Get ColumnMap.
 getFilters ()
 getOptions ()
 Get Options.
 getTable ()
 Get Table.
 removeFilter ($class)
 setColumnMap (array $columnMap)
 Set ColumnMap.
 setTable ($table)
 Set Table.
 shutdown ()
 Shutdown.

Static Public Member Functions

static factory ($config)
 Construct a Zend_Log driver.

Protected Attributes

 $_columnMap
 $_table = null

Detailed Description

Definition at line 31 of file DoctrineTable.php.


Constructor & Destructor Documentation

Robo47_Log_Writer_DoctrineTable::__construct ( table,
array $  columnMap = array() 
)
Parameters:
Doctrine_Table|string $table
array $columnMap

Definition at line 59 of file DoctrineTable.php.

References setColumnMap(), and setTable().

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

Here is the call graph for this function:


Member Function Documentation

Robo47_Log_Writer_DoctrineTable::_write ( event  ) 

Write Event to database.

Parameters:
array $event

Definition at line 137 of file DoctrineTable.php.

    {
        $entry = $this->_table->create(array());
        foreach ($this->_columnMap as $eventIndex => $tableColumn) {
            $entry->$tableColumn = $event[$eventIndex];
        }
        $entry->save();
    }

static Robo47_Log_Writer_DoctrineTable::factory ( config  )  [static]

Construct a Zend_Log driver.

Parameters:
array|Zend_Config $config
Returns:
Robo47_Log_Writer_DoctrineTable

Definition at line 160 of file DoctrineTable.php.

    {
        if ($config instanceof Zend_Config) {
            $config = $config->toArray();
        }
        if (!isset($config['table'])) {
            $message = 'No table defined for Robo47_Log_Writer_DoctrineTable';
            throw new Robo47_Log_Writer_Exception($message);
        }
        $writer = new Robo47_Log_Writer_DoctrineTable($config['table']);
        if (isset($config['columnMap'])) {
            $writer->setColumnMap($config['columnMap']);
        }
        return $writer;
    }

Robo47_Log_Writer_DoctrineTable::getColumnMap (  ) 

Get ColumnMap.

Returns:
array

Definition at line 114 of file DoctrineTable.php.

Referenced by getOptions().

    {
        return $this->_columnMap;
    }

Here is the caller graph for this function:

Robo47_Log_Writer_Abstract::getFilters (  )  [inherited]
Returns:
array

Definition at line 60 of file Abstract.php.

    {
        return $this->_filters;
    }

Robo47_Log_Writer_DoctrineTable::getOptions (  ) 

Get Options.

Returns:
array

Definition at line 124 of file DoctrineTable.php.

References getColumnMap(), and getTable().

    {
        return array(
            'columnMap' => $this->getColumnMap(),
            'table' => $this->getTable(),
        );
    }

Here is the call graph for this function:

Robo47_Log_Writer_DoctrineTable::getTable (  ) 

Get Table.

Returns:
Doctrine_Table

Definition at line 90 of file DoctrineTable.php.

Referenced by getOptions(), and setTable().

    {
        return $this->_table;
    }

Here is the caller graph for this function:

Robo47_Log_Writer_Abstract::removeFilter ( class  )  [inherited]
Parameters:
string|Robo47_Log_Filter_Interface $class
Returns:
Robo47_Log_Writer_Abstract *Provides Fluent Interface*

Definition at line 40 of file Abstract.php.

    {
        foreach ($this->_filters as $key => $filter) {
            if (is_string($class)) {
                if ($filter instanceof $class) {
                    unset($this->_filters[$key]);
                }
            } elseif (is_object($class)) {
                if ($filter === $class) {
                    unset($this->_filters[$key]);
                }
            }
        }
        return $this;
    }

Robo47_Log_Writer_DoctrineTable::setColumnMap ( array $  columnMap  ) 

Set ColumnMap.

Parameters:
array $columnMap
Returns:
Robo47_Log_Writer_DoctrineTable *Provides Fluent Interface*

Definition at line 101 of file DoctrineTable.php.

Referenced by __construct().

    {
        if (count($columnMap) > 0) {
            $this->_columnMap = $columnMap;
        }
        return $this;
    }

Here is the caller graph for this function:

Robo47_Log_Writer_DoctrineTable::setTable ( table  ) 

Set Table.

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

Definition at line 71 of file DoctrineTable.php.

References getTable().

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;
        return $this;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

Robo47_Log_Writer_DoctrineTable::shutdown (  ) 

Shutdown.

Definition at line 149 of file DoctrineTable.php.

    {
        $this->_table = null;
    }


Member Data Documentation

Robo47_Log_Writer_DoctrineTable::$_columnMap [protected]
Initial value:
 array(
        'message' => 'message',
        'priority' => 'priority',
        'category' => 'category',
        'timestamp' => 'timestamp',
    )

Definition at line 41 of file DoctrineTable.php.

Robo47_Log_Writer_DoctrineTable::$_table = null [protected]

Definition at line 52 of file DoctrineTable.php.


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