Watchlist is the class which can hold the variables for developers debugging. By default SQL queries are added to the Watchlist.
Methods
Following static methods are available in Watchlist
- add($element, $label = null, $returnStack = false, $clearStack = false)
- printList($clearStack = true)
- clear()
- trace($levels = 10, $label = null)
Examples
To add an element to watchlist, use this code
Watchlist::add($employeeDetails);
Use this code to print the entire Watchlist. This can generally reside in the footer of your template. You can control the visibility by checking the environment.
if(Box::getEnvironment()['name'] == 'local'){ Watchlist::printList(); }
To clear the list, use this code.
Watchlist::clear()