views:

37

answers:

1

So I have an action helper (from which I call a second action helper):

<?php
class My_Controller_Action_Helper_Helper1 extends Zend_Controller_Action_Helper_Abstract
{   
    public function direct()
    {
        $theActionController = $this->getActionController();
        $helper =  Zend_Controller_Action_HelperBroker::getStaticHelper('Helper2');
        $helper->direct(theActionController );
    }
}

Here is my second helper, you can see I send a variable to view:

<?php
class My_Controller_Action_Helper_Helper2 extends Zend_Controller_Action_Helper_Abstract
{   
    public function direct(theActionController )
    {
        $theActionController->view->a = 'bbb';
    }
}

In my controller I do:

$this->_helper->helper1();
var_dump($this->view->a);

The output is:

NULL

Why is that?

I send the controller object as an argument to the second helper from the first.

+1  A: 

Is it just a typo or are you actually missing the dollar sign prefixes on the two theActionController instances?

Phil Brown