I'm not sure I understand - what I'm supposed to do now instead of
Zend::dump?
I had in mind using the new Zend_Log class. First set up a logger:
$log = new Zend_Log(new Zend_Log_Writer_Debug('php://stdout'));
You only have to set that up once, if you store the $log object
somewhere that is accessible throughout your app.
Then you can dump a variable anytime like this:
$log->debug( $myObject );
I really don't think that's a good replacement for Zend::dump. I used it
for print-debugging a lot since it's better that var_dump and as easy as
var_dump. Now you propose to kill it and replace with two-stage
constructor and carrying over the object which I really don't need. It's
not simple. It's not easy. Zend::dump is *easy*, having two-level ctor
and additional object is *complex*. I don't like the direction we are
moving in - it's definitely looks like what I don't like in Java - you
have to do a lot of actions before you get result and care for a lot of
classes which you really don't want to know to do a simplest thing like
output debug value. I don't want to learn about log writers and
interfaces and loggin infrastructure and php://stdout and stuff just to
do a simple debug-print.
Yes, I agree. I always have to think for a split-second about which one
sets and which one gets. :-) I will be happy to see register() and
registry() become deprecated.
OK, make it get() and put() - but it should be *easy*. It should not
require knowing about singletons and instances. The concept of putting
and getting variable in registry is simple, so should be acting on this
concept in framework. If you want to do complex stuff (like having
multiple registries) then it can be complex, but easy actions should be
done by easy code. That's why we have SimpleXML - that's why we should
have SimpleRegistry and SimpleDump :)
You don't have to use getInstance() each time. If you have an object of
type Zend_Registry, just use the array notation. You are not required
I don't want to have "object of type Zend_Registry" - I want just global
access to registry, like I had with Zend::register(). How I do it with
Zend_Registry?
to use the default static instance of the registry. You can create an
I *want* to use it. Actually, in 90% of use cases I don't care it all
how many objects there are and what they are - I just want to put stuff
there and get stuff from there. I don't want to know how it is implemented.
instance of a Zend_Registry object and put it anywhere you want -- even
a global variable:
// in bootstrap:
$globalReg = new Zend_Registry();
// anywhere in application:
$globalReg['key'] = 'value';
Errr? So we went all this long way with registry - only to get back to
global variables? If I wanted global variables, why would I need
Framework anyway? What's the added value there?
--
Stanislav Malyshev, Zend Products Engineer
[EMAIL PROTECTED] http://www.zend.com/