Debug instantiated classes in Magento

Asked

Viewed 96 times

0

In the PHP there are methods get_object_vars and get_class that return information about the class, in Magento we can use Zend_Debug::dump(), the Mage::log() and even the Xdebug of PHP, but during the development of modules in Magento, where we need to overwrite some part of the administrative panel, for this we have to look for the correct classes.

How to get the list of all instantiated classes when accessing a Magento page?

Example: The user X accessed Catálogo->Atributo->Gerenciar Atributo, how to generate a Debug with the list of all classes that were instantiated when the user accessed the page Gerenciar Atributo?

1 answer

0


I found 2 solutions to my problem

1st Exists Mage_Core_Model_Config::getModelInstance

public function getModelInstance($modelClass='', $constructArguments=array())
    {
        $className = $this->getModelClassName($modelClass);
        if (class_exists($className)) {
            Varien_Profiler::start('CORE::create_object_of::'.$className);
            $obj = new $className($constructArguments);
            Varien_Profiler::stop('CORE::create_object_of::'.$className);
            return $obj;
        } else {
            return false;
        }
    }

can use this method to find all instantiated classes. By Proxiblue

2º Add

 <pre>
<?php htmlspecialchars( print_r( get_included_files() )); ?>
</pre>

At the end of arquivo.php . This prints each file included by Magento for a particular request, and since the Magento files are named consistently you can derive the class names. For Alan Storm

Browser other questions tagged

You are not signed in. Login or sign up in order to post.