-- depace <[EMAIL PROTECTED]> wrote
(on Wednesday, 21 March 2007, 02:53 PM +0530):
> ok guys i have one question...
> please let me know if its possible or not...  (in ZF 0.9 beta)
> 
> I want to initialize object in one controller and want to use it in another 
> ...
> is it possible??/
> 
> AbcController:
> $obj_abc = new AbcClass();
> $obj_abc->doSomething();
> Zend_Registry::set('obj',$obj_abc);
> (Works if i move this to boostrap file and if i call from some controller)
> 
> XyzController:
> $obj_abc = Zend_Registry::get('obj');

It's only possible if 'obj' has previously been registered. You can
check that pretty easily:

    if (!Zend_Registry::isRegistered('obj')) {
        // maybe instantiate and register it, or throw an exception
    } else {
        $obj = Zend_Registry::get('obj');
    }


> On 12/19/06, Gavin Vess <[EMAIL PROTECTED] > wrote:
> 
>     Try "$registry = Zend::registry();"
> 
>     Moving discussion to [EMAIL PROTECTED]
> 
>     F bio T. da Costa wrote:
>     > Zend_Registry :: getInstance() not work in 0.6.
>     > The tutorial " AJAX Chat Tutorial" not work:
>     > http://devzone.zend.com/node/view/id/1387
>     >
>     >
>     > Bill Karwin wrote:
>     >
>     >> Yann Nave wrote:
>     >>
>     >>> I would like to use Registry object, But it seems not in 0.6 preview.
>     >>>
>     >> Zend_Registry moved from incubator to core in 0.6
>     --
>     Cheers,
>     Gavin
> 
>     Which ZF List?
>     =================
>     Everything, except the topics below: [email protected]
> 
>     Authorization, Authentication, ACL, Access Control, Session Management
>     [EMAIL PROTECTED]
> 
>     Tests, Caching, Configuration, Environment, Logging
>     [EMAIL PROTECTED]
> 
>     All things related to databases
>     [EMAIL PROTECTED]
> 
>     Documentation, Translations, Wiki Manual / Tutorials
>     [EMAIL PROTECTED]
> 
>     Internationalization & Localization, Dates, Calendar, Currency, Measure
>     [EMAIL PROTECTED]
> 
>     Mail, MIME, PDF, Search, data formats (JSON, ...)
>     [EMAIL PROTECTED]
> 
>     MVC, Controller, Router, Views, Zend_Request*
>     [EMAIL PROTECTED]
> 
>     Community Servers/Services (shell account, PEAR channel, Jabber)
>     [EMAIL PROTECTED]
> 
>     Web Services & Servers (HTTP, SOAP, Feeds, XMLRPC, REST)
>     [EMAIL PROTECTED]
> 
> 
>     How to un/subscribe:  http://framework.zend.com/wiki/x/GgE
> 
> 
> 
> 

-- 
Matthew Weier O'Phinney
PHP Developer            | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/

Reply via email to