Magento forces MVC and EAV. Configuration is a mix between DB, config files and code. Objects use magic methods __get __call __set etc.Lazy Loading and CachingPoor documentation on the set up.Oh yea the singletons, collections and helpers make a fine mess when trying to do something.
I was going to paste in a full print_r or var_dump of one of the objectsBut one of the simplest objects took about 20 slides So as you can see usingprint_r and var_dump will be troublesome since you have to send all this data over http to the browser to look at it.
What was I to do?How can I go on and make changes in Magento ?How the hell did others make wonderful extensions and plugins ?
xDebug provided the solutionYou can set break pointsget stack tracesview data and objects as they are being instantiated
Now I was able to get to work coding and making the boss happy which made me happy
Gotohttp://www.xdebug.org/find-binary.phpPaste in the output of : php -iDownload the binary suggestedInstall the binary as a zend_extensionMake sure you have a php.iniDerickRethans offers a suggestion on the page as wellphp –i >> info.txtremote_enable: Starts a remote session when flag calledremote_host: sets the host name remote_port: 9000 by default change for firewallremote_handler: dbgp (debugging protocol)
Eclipse is a little more complicated Before you start: Make sure all files your code can touch is located in projects or is referenced in the include pathsNote: Break at 1st line needs eclipse to restart to take effect
Use Multi session to on Accept Remote Session JIT (Just In Time)
Just Double click on the line you want to break You can also right click and select toggle break pointOpen the browser Pass in XDEBUG_SESSION_START=true in the URL (Switch to eclipse )
Debug Tab: Controls stepping and displays current stack traceF5 – StepF6 – Step over (skips over a function call)F7 – Step Return When in a function will continue to the return statementF8 – Resume to next breakpointPHP stores the stack in strange ways (too much to explain in class) which is why you will see the stack as a tree
Variables Tab, Lists all variables, the current state and there value (Cannot change values of variables here)
Breakpoints TabAllow you to toggle breakpoints on and off Can set the condition for the variable to allow you to change values Step filters are not implemented
Improved Error Out putting
Profiling (cache grind)
Code Coverage (PHP Unit)
How x debug restored partial sanity to the insane
How XDebugrestored partial sanity to the insane world of PHP<br />
In the beginning …….<br />Echo<br />Print<br />
In the beginning …….<br />var_dump<br />print_r<br />