Debug instanced classes in Magento

0

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

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

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

    
asked by anonymous 06.02.2014 / 14:33

1 answer

0

I found 2 solutions to my problem

1st There is 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;
        }
    }

You can use this method to find all instantiated classes. By ProxiBlue

2nd Add

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

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

    
06.02.2014 / 20:11