0

I am using Zend Modular Application approach. I have setup Zend_Acl module wise. I have already one Mapper class say Default_Model_AirlineMapper set up in Default Module.

class Default_Model_AirlineMapper extends Model_AbstractMapper {

    public static function fetchAll($columns = null) {

        $dbTableObj = new Default_Model_DbTable_Airline();      
        $select = $dbTableObj->select();

        if( is_array($columns) && sizeof($columns) > 0 ) $select->from($dbTableObj, $columns );


        return $dbTableObj->fetchAll( $select );
    }
}

Now I am trying to access this Default_Model_AirlineMapper from admin module controller like

public function employeepreferredairlinesAction(){

        $dom_airlines = Default_Model_AirlineMapper::fetchAll(array('airline_id','airline_name'), null, array('airline_name asc'));
        $this->view->dom_airline_dd = Zend_Json::encode($dom_airlines);
}

I have set up access check plugin for default module like

class Default_Plugin_AccessCheck extends Zend_Controller_Plugin_Abstract {

    public function preDispatch(Zend_Controller_Request_Abstract $request) {

        if('default' === ($module = $request->getModuleName())){
            // Do acl check
        }else{
            // throw it to default login 
            $request->setModuleName('default')->setControllerName('index')->setActionName('login');
        }
    }
}

In short when i try to access Default_Model_AirlineMapper::fetchAll() it thows me to default modele login page, but when I comment it, it works fine.

What is happening here I am not getting. it is only possible when default modules Bootstrap.php get executed, but I am working and accessing from admin module. Please explain.

Rajan Rawal
  • 6,171
  • 6
  • 40
  • 62
  • 1
    Not sure what you are really trying to do here but you protect only access to your (Default) controller and not the mapper. – Adrian World May 09 '13 at 16:10
  • Zend_Acl can protect/unprotect anything you specify. It works with resources that you define and access rules that you define. There is no default behavior. – RockyFord May 10 '13 at 09:10

0 Answers0