Ehask71 wrote:
> So I read up and then I created this function in my Bootstrap.php
> 
> public function _initLog()
> {
>         $resource = $this->getPluginResource('db');
>         $db = $resource->getDbAdapter();
>         $columnMapping = array('lvl' => 'priority', 'msg' => 'message');
>         $writer = new Zend_Log_Writer_Db($db, 'log', $columnMapping);
>         $logger = new Zend_Log($writer);
>         $logger->warn('Logger Init');
>         
>         return $logger;       
> }
> 
> I see the "Logger Init" in my Log Table so I know this is firing correctly.
> 
> So I moved on to my Action Controller and put 
> 
>    $logger = $this->getInvokeArg('bootstrap')->getResource('logger');
> 
> Which results in:
>     Fatal error: Call to a member function getResource() on a non-object in
> /sites/performance/performance-api/application/controllers/XmlController.php
> on line 25
> 
> Line 25 is  $logger =
> $this->getInvokeArg('bootstrap')->getResource('logger');
> 
> Do I have to create Resource Plugins for everything or am I missing
> something to place $logger as a resource?
[...]

Your method is called _initLog(), so the resource (which contains the
return value of the method) is called "log". Try:

$this->getInvokeArg('bootstrap')->getResource('log');

-- 

Brenton Alker
PHP Developer - Brisbane, Australia

http://blog.tekerson.com/

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to