End Your If

Helping you solve those tough coding problems!

Learn some great development tips and techniques through recipes that clearly define the problem being solved with a working solution.
Popular Tags: cakephp | theory | optimization | javascript-development | asp-net | ajax | sql | php-development | jquery-development | css

Search:
Follow @endyourif rss Facebook LinkedIn
My Books

Cannot find module (SNMPv2-TC) Cannot find module (SNMPv2-TC)

Published on Feb 18, 2019 by Jamie Munro

When I run PHP via the command line (aka php cli), I often would be spammed with the following error messages:
Cannot find module (SNMPv2-TC)
Cannot find module (SNMPv2-SMI)

Messages like this would repeat for 30 or 40 lines. These errors would not stop my command from executing; however, it was extremely noisy when trying to see the output.

Read more >

Tags: CakePHP | PHP

Setting Up CakePHP with IIS Setting Up CakePHP with IIS

Published on Jun 11, 2013 by Jamie Munro

Iíve found myself doing this several times over the past little while as I had to switch computers.† Each time I would struggle with a few of the steps, so I thought I would document them this time and share for future me (or you if you like).

Read more >

Tags: CakePHP | php | PHP | mysql | iis | CakePHP

Setting Up CakePHP with IIS Setting Up CakePHP with IIS

Published on Jun 11, 2013 by Jamie Munro

Iíve found myself doing this several times over the past little while as I had to switch computers.† Each time I would struggle with a few of the steps, so I thought I would document them this time and share for future me (or you if you like).

Read more >

Tags: CakePHP | php | PHP | mysql | iis | CakePHP

Implementing the Repository Pattern with CakePHP Implementing the Repository Pattern with CakePHP

Published on Jun 3, 2013 by Jamie Munro

I must admit, my recent articles are becoming a bit obsessed around the repository pattern.† What can I say, I like it, itís useful, and itís not restrictive based on a language or a framework.

Iíve long professed how I dislike convoluted controllers.† CakePHPís find method almost immediately causes this when used inside a controller.† More importantly, the code inside the find method is extremely unreadable.† This is almost more important than a large controller function!

This is where the repository pattern comes in.† At its most basic example (which some will consider overkill Ė you know who you are), I still think the repository pattern is clearer.

Here is an example using the regular find approach:


$user = $this->User->find('first', array('conditions' => array('id' => $id)));


Compared to a repository example:


$user = $this->UserRepository->GetById($id);


The code is almost identically; however, in the second example, itís clear that if I were to ďreadĒ the code I am retrieving a user by id opposed to Iím finding the first user with the conditions of id being equal to the variable $id.

So if you are sold, letís continue with a full suite exampleÖ

Read more >

Tags: CakePHP | PHP | repository | CakePHP

Implementing the Repository Pattern with CakePHP Implementing the Repository Pattern with CakePHP

Published on Jun 3, 2013 by Jamie Munro

I must admit, my recent articles are becoming a bit obsessed around the repository pattern.† What can I say, I like it, itís useful, and itís not restrictive based on a language or a framework.

Iíve long professed how I dislike convoluted controllers.† CakePHPís find method almost immediately causes this when used inside a controller.† More importantly, the code inside the find method is extremely unreadable.† This is almost more important than a large controller function!

This is where the repository pattern comes in.† At its most basic example (which some will consider overkill Ė you know who you are), I still think the repository pattern is clearer.

Here is an example using the regular find approach:


$user = $this->User->find('first', array('conditions' => array('id' => $id)));


Compared to a repository example:


$user = $this->UserRepository->GetById($id);


The code is almost identically; however, in the second example, itís clear that if I were to ďreadĒ the code I am retrieving a user by id opposed to Iím finding the first user with the conditions of id being equal to the variable $id.

So if you are sold, letís continue with a full suite exampleÖ

Read more >

Tags: CakePHP | PHP | repository | CakePHP

Changes to Model:find('first') in CakePHP 2.3 Changes to Model:find('first') in CakePHP 2.3

Published on Jan 30, 2013 by Jamie Munro

Changes to Model:find('first') in CakePHP 2.3 Changes to Model:find('first') in CakePHP 2.3

Published on Jan 30, 2013 by Jamie Munro

Recent Guest Posts on PHPMaster.com Recent Guest Posts on PHPMaster.com

Published on Jan 7, 2013 by Jamie Munro

Recent Guest Posts on PHPMaster.com Recent Guest Posts on PHPMaster.com

Published on Jan 7, 2013 by Jamie Munro

CakePHP Global Constants and Functions CakePHP Global Constants and Functions

Published on Sep 21, 2012 by Jamie Munro

CakePHP Global Constants and Functions CakePHP Global Constants and Functions

Published on Sep 21, 2012 by Jamie Munro

CakePHP Extending one View from Another CakePHP Extending one View from Another

Published on Sep 20, 2012 by Jamie Munro

CakePHP Extending one View from Another CakePHP Extending one View from Another

Published on Sep 20, 2012 by Jamie Munro

CakePHP 2.x Login System CakePHP 2.x Login System

Published on Sep 18, 2012 by Jamie Munro

CakePHP 2.x Login System CakePHP 2.x Login System

Published on Sep 18, 2012 by Jamie Munro

A Short Rant About Coding Conventions A Short Rant About Coding Conventions

Published on Sep 13, 2012 by Jamie Munro

Are you having CakePHP and NGINX Rewrite Rule Issues? Are you having CakePHP and NGINX Rewrite Rule Issues?

Published on Sep 10, 2012 by Jamie Munro

Are you having CakePHP and NGINX Rewrite Rule Issues? Are you having CakePHP and NGINX Rewrite Rule Issues?

Published on Sep 10, 2012 by Jamie Munro

What I Learned This Summer What I Learned This Summer

Published on Sep 7, 2012 by Jamie Munro

CakePHP Version Comparison with PHP Version Comparison CakePHP Version Comparison with PHP Version Comparison

Published on Jun 25, 2012 by Jamie Munro

CakePHP Version Comparison with PHP Version Comparison CakePHP Version Comparison with PHP Version Comparison

Published on Jun 25, 2012 by Jamie Munro

Officially published my CakePHP Book Officially published my CakePHP Book

Published on May 19, 2011 by Jamie Munro

Officially published my CakePHP Book Officially published my CakePHP Book

Published on May 19, 2011 by Jamie Munro

CakePHP 1.2 VS 1.3 VS 2.0 Page Request Times CakePHP 1.2 VS 1.3 VS 2.0 Page Request Times

Published on Mar 7, 2011 by Jamie Munro

CakePHP 1.2 VS 1.3 VS 2.0 Page Request Times CakePHP 1.2 VS 1.3 VS 2.0 Page Request Times

Published on Mar 7, 2011 by Jamie Munro

AJAX Star Rating Plugin For CakePHP AJAX Star Rating Plugin For CakePHP

Published on Mar 2, 2011 by Jamie Munro

AJAX Star Rating Plugin For CakePHP AJAX Star Rating Plugin For CakePHP

Published on Mar 2, 2011 by Jamie Munro

CakePHP 2-0 Ajax Pagination WITHOUT The Pages CakePHP 2-0 Ajax Pagination WITHOUT The Pages

Published on Feb 28, 2011 by Jamie Munro

CakePHP 2-0 Ajax Pagination WITHOUT The Pages CakePHP 2-0 Ajax Pagination WITHOUT The Pages

Published on Feb 28, 2011 by Jamie Munro

CakePHP CSS Enhancements From 1.2 To 1.3 CakePHP CSS Enhancements From 1.2 To 1.3

Published on Feb 23, 2011 by Jamie Munro

CakePHP CSS Enhancements From 1.2 To 1.3 CakePHP CSS Enhancements From 1.2 To 1.3

Published on Feb 23, 2011 by Jamie Munro

Publishing an e-book on Smashwords Publishing an e-book on Smashwords

Published on Feb 7, 2011 by Jamie Munro

Publishing an e-book on Smashwords Publishing an e-book on Smashwords

Published on Feb 7, 2011 by Jamie Munro

Interesting CakePHP Bakery Components Interesting CakePHP Bakery Components

Published on Feb 3, 2011 by Jamie Munro

CakePHP 2.0 Rant Retraction CakePHP 2.0 Rant Retraction

Published on Feb 1, 2011 by Jamie Munro

CakePHP 2.0 Rant CakePHP 2.0 Rant

Published on Jan 31, 2011 by Jamie Munro

Using the TextHelper with CakePHP Using the TextHelper with CakePHP

Published on Jan 24, 2011 by Jamie Munro

Using the TextHelper with CakePHP Using the TextHelper with CakePHP

Published on Jan 24, 2011 by Jamie Munro

Modifying the CakePHP Bakery Templates Modifying the CakePHP Bakery Templates

Published on Jan 3, 2011 by Jamie Munro

Modifying the CakePHP Bakery Templates Modifying the CakePHP Bakery Templates

Published on Jan 3, 2011 by Jamie Munro

Maintaining the back button with AJAX Maintaining the back button with AJAX

Published on Dec 28, 2010 by Jamie Munro

Maintaining the back button with AJAX Maintaining the back button with AJAX

Published on Dec 28, 2010 by Jamie Munro

Optimizing CakePHP Websites Optimizing CakePHP Websites

Published on Jan 20, 2010 by Jamie Munro

Optimizing CakePHP Websites Optimizing CakePHP Websites

Published on Jan 20, 2010 by Jamie Munro

Adding SEO functionality Adding SEO functionality

Published on Nov 15, 2009 by Jamie Munro

Adding SEO functionality Adding SEO functionality

Published on Nov 15, 2009 by Jamie Munro

unbindModel and $this->paginate() unbindModel and $this->paginate()

Published on Aug 20, 2009 by Jamie Munro

unbindModel and $this->paginate() unbindModel and $this->paginate()

Published on Aug 20, 2009 by Jamie Munro

Photobucket, Photos, and You Photobucket, Photos, and You

Published on May 23, 2009 by Jamie Munro

Facebook, Photos, and You! Facebook, Photos, and You!

Published on May 18, 2009 by Jamie Munro

Caching Queries in CakePHP Caching Queries in CakePHP

Published on Apr 25, 2009 by Jamie Munro

Custom pagination query in CakePHP Custom pagination query in CakePHP

Published on Apr 13, 2009 by Jamie Munro

3 Flaws to CakePHP's AuthComponent 3 Flaws to CakePHP's AuthComponent

Published on Apr 10, 2009 by Jamie Munro

A friendly framework reminder A friendly framework reminder

Published on Apr 1, 2009 by Jamie Munro

A friendly framework reminder A friendly framework reminder

Published on Apr 1, 2009 by Jamie Munro

Unbind Model Validation in CakePHP Unbind Model Validation in CakePHP

Published on Mar 28, 2009 by Jamie Munro

Unbind Model Validation in CakePHP Unbind Model Validation in CakePHP

Published on Mar 28, 2009 by Jamie Munro

Login system with CakePHP in under 10 minutes Login system with CakePHP in under 10 minutes

Published on Mar 23, 2009 by Jamie Munro

Optimize your CSS and JS with CakePHP in minutes Optimize your CSS and JS with CakePHP in minutes

Published on Mar 21, 2009 by Jamie Munro

Optimize your CSS and JS with CakePHP in minutes Optimize your CSS and JS with CakePHP in minutes

Published on Mar 21, 2009 by Jamie Munro

Importance of using the CakePHP Helpers Importance of using the CakePHP Helpers

Published on Mar 20, 2009 by Jamie Munro

Importance of using the CakePHP Helpers Importance of using the CakePHP Helpers

Published on Mar 20, 2009 by Jamie Munro

Re-map key/value array data in PHP Re-map key/value array data in PHP

Published on Mar 19, 2009 by Jamie Munro

Re-map key/value array data in PHP Re-map key/value array data in PHP

Published on Mar 19, 2009 by Jamie Munro

When to use element() and when to requestAction() When to use element() and when to requestAction()

Published on Mar 16, 2009 by Jamie Munro

CakePHP Containable Statement Pitfalls CakePHP Containable Statement Pitfalls

Published on Mar 15, 2009 by Jamie Munro

CakePHP Containable Statement Pitfalls CakePHP Containable Statement Pitfalls

Published on Mar 15, 2009 by Jamie Munro

Keeping your CakePHP Controllers Clean Keeping your CakePHP Controllers Clean

Published on Mar 14, 2009 by Jamie Munro

Keeping your CakePHP Controllers Clean Keeping your CakePHP Controllers Clean

Published on Mar 14, 2009 by Jamie Munro

Drag and drop category management with CakePHP Drag and drop category management with CakePHP

Published on Mar 11, 2009 by Jamie Munro

Drag and drop category management with CakePHP Drag and drop category management with CakePHP

Published on Mar 11, 2009 by Jamie Munro

How to add comments with AJAX in CakePHP How to add comments with AJAX in CakePHP

Published on Mar 9, 2009 by Jamie Munro

How to add comments with AJAX in CakePHP How to add comments with AJAX in CakePHP

Published on Mar 9, 2009 by Jamie Munro

How to advance our CMS in CakePHP How to advance our CMS in CakePHP

Published on Mar 8, 2009 by Jamie Munro

How to advance our CMS in CakePHP How to advance our CMS in CakePHP

Published on Mar 8, 2009 by Jamie Munro

How to create a CMS with CakePHP How to create a CMS with CakePHP

Published on Mar 7, 2009 by Jamie Munro

How to create a CMS with CakePHP How to create a CMS with CakePHP

Published on Mar 7, 2009 by Jamie Munro

AJAX Select box in CakePHP AJAX Select box in CakePHP

Published on Mar 6, 2009 by Jamie Munro

AJAX Select box in CakePHP AJAX Select box in CakePHP

Published on Mar 6, 2009 by Jamie Munro

How to setup a route in CakePHP How to setup a route in CakePHP

Published on Mar 5, 2009 by Jamie Munro

How to setup a route in CakePHP How to setup a route in CakePHP

Published on Mar 5, 2009 by Jamie Munro

StringExtractComponent for CakePHP StringExtractComponent for CakePHP

Published on Feb 28, 2009 by Jamie Munro

StringExtractComponent for CakePHP StringExtractComponent for CakePHP

Published on Feb 28, 2009 by Jamie Munro

Why Frameworks Are Better Why Frameworks Are Better

Published on Feb 17, 2009 by Jamie Munro

Why Frameworks Are Better Why Frameworks Are Better

Published on Feb 17, 2009 by Jamie Munro