ObjectMulti.php

Go to the documentation of this file.
00001 <?php
00002 
00031 class Robo47_Application_Resource_ObjectMulti
00032 extends Zend_Application_Resource_ResourceAbstract
00033 {
00034 
00038     protected $_objects = array();
00039 
00043     public function init()
00044     {
00045         if (!empty($this->_options)) {
00046             foreach ($this->_options as $name => $options) {
00047                 $resource = new Robo47_Application_Resource_Object($options);
00048                 $resource->init();
00049                 $this->_objects[$name] = $resource->getObject();
00050             }
00051         } else {
00052             $message = 'Empty options in resource ' .
00053                 'Robo47_Application_Resource_ObjectMulti.';
00054             throw new Robo47_Application_Resource_Exception($message);
00055         }
00056     }
00057 
00063     public function getObject($name)
00064     {
00065         if (isset($this->_objects[$name])) {
00066             return $this->_objects[$name];
00067         } else {
00068             $message = 'Object \'' . $name . '\' doesn\'t exist';
00069             throw new Robo47_Application_Resource_Exception($message);
00070         }
00071     }
00072 
00078     public function getObjects()
00079     {
00080         return $this->_objects;
00081     }
00082 }