Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot use Zend_Debug::dump in ZF2..how do I?

I'm using the skeleton application for ZF2.0.0Beta3.

So, normally I would just use Zend_Debug::dump($someVar); however, in ZF2 it doesn't include the zend classes it seems.

The error is: Fatal Error: Class 'Zend_Debug' not found..

This is probably a really basic question, but what's the best way to include that class? Do I have to put require_once('path/to/Debug.php');?

like image 745
roberttstephens Avatar asked Nov 30 '22 06:11

roberttstephens


2 Answers

It still exists in ZF2, but since ZF2 started using PHP namespaces, you would now have to call it using the Zend namespace:

\Zend\Debug\Debug::dump($var);

or add a use statement at the beginning of the file and call it like this:

use Zend\Debug\Debug;

Debug::dump($var);
like image 150
drew010 Avatar answered Dec 08 '22 00:12

drew010


In my case this was the correct namespace-path :

\Zend\Debug\Debug::dump($form);
like image 36
user1587750 Avatar answered Dec 07 '22 23:12

user1587750