Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save beberlei/144386 to your computer and use it in GitHub Desktop.
Save beberlei/144386 to your computer and use it in GitHub Desktop.
<?php
/**
* @package Whitewashing
*
*/
class Whitewashing_Controller_Helper_Container extends Zend_Controller_Action_Helper_Abstract
{
/**
* @var Yadif_Container
*/
protected $_container = null;
public function init()
{
$this->_container = $this->_actionController->getInvokeArg('bootstrap')->getContainer();
}
/**
* @param string $resource
* @return object
*/
public function direct($resource)
{
$object = $this->_container->$resource;
if($object == null) {
throw new Exception(
"Unknown resource '".$resource."' accessed."
);
}
return $object;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment