Sarajevo, Bosnia and Herzegovina

Category Archives: Technology

Posts related to my job or interests

Installing PHPUnit On Windows

Assuming you already have PHP and MySQL installed, here’s the steps you need to take. Install PEAR, a dependency for PHPUnit: Visit http://pear.php.net/go-pear.phar in your browser and save the file into your PHP directory. This is the folder where you can find php.exe. Open an administrator command prompt. On Vista or Windows 7, hit your Windows […]

Read more

Advanced Policy Firewall

Advanced Policy Firewall (APF) is an iptables(netfilter) based firewall system designed around the essential needs of today’s Linux servers. The configuration is designed to be very informative and easy to follow. The management on a day-to-day basis is conducted from the command line with the ‘apf’ command, which includes detailed usage information on all the […]

Read more

CakePhp – How to fetch root categories with childs associated

Very simple : /** * Get categories with childs by parent id * @return array */ public function getRootCategoriesHaveChilds(){ $conditions = array(‘Category.parent_id ‘ => 0); $fields = array(‘Category.*’,'(SELECT COUNT( cat2.id ) FROM categories AS cat2 WHERE cat2.parent_id = Category.id) as Total’ ); $group = array(‘Category.id HAVING Total>0’); return $this->find(‘all’, array(‘conditions’=>$conditions, ‘fields’=>$fields, ‘group’ => $group, ‘recursive’ […]

Read more

CakePhp – how to disable validation

Well, first you must know that almost all stuff in cakePHP is stored in arrays, from top-develop side of view. So basic way to disable validation on some model is very simple : $this->Model->validate = array(); // Stop validation on the model Happy coding!

Read more