Blog Archives
Working with DataBases in Magento (Contd…)
Let’s continue our discussion. Now we would discuss on topics like some basic model function, install and upgrade scripts and then have some details about EAV concept.
Zend_Db_Select: Magento implements the Zend_Db_Select class to handle the SELECT statements for its models and collections. We can access Zend_Db_Selection by calling $collection->getSelect().
Inheritence diagram of Zend_Db_Select
You can get more details about Zend_Db_Select by referring to document
http://magentodocs.org/1.7.0.2/d3/dc0/class_zend___db___select.php
Debugging in Magento
Every application that is being built requires debugging to fix issues. Magento is an ecommerce application that is built on opesource PHP with the help of Varien and Zend Classes. So, let’s look into various aspects how we can debug in Magento.
Logs: In Magento we can create write logs and check the execution. For writing log we can use Mage::log() or Mage::logException(). If we want to log something in a new file we can use the statements like:
Mage::log(‘My log entry’.print_r($something,true), null, ‘mylogfile.log’);
This log file would be created in var/log folder.