Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6620903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:10:03+00:00 2026-05-25T21:10:03+00:00

I am converting an old ZF app (its using an early ZF version where

  • 0

I am converting an old ZF app (its using an early ZF version where we used to do manual app loading/config in the index.php) to latest version, and in one of the plugin we are sending data directly to the plugin constructor

$front->registerPlugin(new My_Plugin_ABC($obj1, $obj2))

Now in the current version we can register a plugin by directly providing the details in the application.ini and I want to stay with this approach(registering using config file). So while testing, I noticed the the plugin constructor is called fairly early in the bootstrapping, so the only option I am left with is using Zend_Registry to store the data, and retrieve it in the hooks. So is it the right way? or are there any other better ways

EDIT
The plugin was actually managing ACL and Auth, and its receiving custom ACL and AUTH objects. Its using the preDispatch hook.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:10:04+00:00Added an answer on May 25, 2026 at 9:10 pm

    Okay so you could consider you ACL and Auth handlers as a some application resources, and be able to add configuration options for them in you application.ini

     //Create a Zend Application resource plugin for each of them
    
     class My_Application_Resource_Acl extends Zend_Application_Resource_Abstract {
         //notice the fact that a resource last's classname part is uppercase ONLY on the first letter (nobody nor ZF is perfect)
         public function init(){
             // initialize your ACL here
             // you can get configs set in application.ini with $this->getOptions()
    
             // make sure to return the resource, even if you store it in Zend_registry for a more convenient access
             return $acl;
         }
     }
    
     class My_Application_Resource_Auth extends Zend_Application_Resource_Abstract {
         public function init(){
             // same rules as for acl resource
             return $auth;
         }
     }
    
     // in your application.ini, register you custom resources path
     pluginpaths.My_Application_Resource = "/path/to/My/Application/Resource/"
     //and initialize them
     resources.acl =    //this is without options, but still needed to initialze
     ;resources.acl.myoption = myvalue // this is how you define resource options
    
     resources.auth =    // same as before
    
     // remove you plugin's constructor and get the objects in it's logic instead
     class My_Plugin_ABC extends Zend_Controller_Plugin_Abstract {
         public function preDispatch (Zend_Controller_Request_Abstract $request){
              //get the objects
              $bootstrap = Zend_Controller_Front::getInstance()->getParam("bootstrap");
              $acl = $bootstrap->getResource('acl');
              $auth = $bootstrap->getResource('auth');
              // or get them in Zend_Registry if you registered them in it
    
              // do your stuff with these objects
    
         }
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm converting an old app that records folder sizes on a daily basis. The
I have some old apps written in PHP that I'm thinking of converting to
Converting an old vs2003 project to vs2010, and I've stumbled on one error: cannot
I'm converting some old PHP 4.x code for PHP 5.3. I've come across the
I'm converting an old VB app to C# and being new to AD, I'm
I'll be embarking on converting one of our old, legacy apps from VB6 to
I am working on converting an old app written in powerbuilder to a .NET
I am converting an old PHP porject over to ASP.Net (vb) and wondered if
Currently converting an old asp.net web forms page into a asp.net mvc version, and
I am converting some old OpenCV code using the C api to the new

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.