Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To access your application resources, you would need to access to the bootstrap object of your Zend_Application, The one you created in your index.php file. You could store either of them somewhere accessible from everywhere, say a Zend_Registry. Suppose this is your public/index.php file:</p> <pre><code> // suppose you have defined the APPLICATION_PATH constant to the application // directory of your project. and the APPLICATION_ENV defines your environment // like production, development or testing. // create a config for your application configurations, defining your resources $config = new Zend_Config_Ini( APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV ); // this is the application object $application = new Zend_Application(APPLICATION_ENV, $config); // now resources are bootstrapping $application-&gt;bootstrap(); $bootstrap = $application-&gt;getBootstrap(); // store them somewhere in registry, so you could access them from everywhere // like controllers, models, etc. Zend_Registry::set('application', $application); </code></pre> <p>Now in your controller (or any other code, like models, view, etc.), you could access this application object using:</p> <pre><code> $application = Zend_Registry::get('application'): /*@var $application Zend_Application*/ $bootstrap = $application-&gt;getBootstrap(); // now you could access any resources from the $bootstrap object $db = $bootstrap-&gt;getResource('db'); $log = $bootstrap-&gt;getResource('log); // now $db is a Zend_Db object bootstrapped from your application config </code></pre> <p>This is a general way of accessing application bootstrap. However in your controllers there is another way to access the bootstrap object (and so the resources), and that is using the '''getInvokeArg('bootstrap')''' of the controller object. So in your controller you could do:</p> <pre><code> $bootstrap = $this-&gt;getInvokeArg('bootstrap'); $db = $bootstrap-&gt;getResource('db'); // now $db is a Zend_Db object bootstrapped from your application config </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload