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

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

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

Published on Jan 30, 2013 by Jamie Munro

A new stable release of CakePHP has just been released a few days ago, version 2.3.  With this many great new changes have come out of it.  You can read the full change log here:
http://bakery.cakephp.org/articles/lorenzo/2013/01/28/cakephp_2_3_0_is_out

One of the things that immediately caught my mind was this great big bolded sentence:
IMPORTANT: Model::find('first') will now return an empty array when no records are found. Make sure you update your tests!

Immediately after reading this I thought major code changes were going to be required; however, luckily my fear was unfounded.  Let me provide an example...

Read more >

Tags: CakePHP | cakephp 2.3

Recent Guest Posts on PHPMaster.com

Published on Jan 7, 2013 by Jamie Munro

I've had the pleasure of being a guest writer at a fantastic site called phpmaster.com.  This site is a subsidiary site to one of the most popular technology blogging sites sitepoint.com.

The first article I wrote is an excellent extension of the various CakePHP articles I've written about in the past.  It discusses a variety of ways to improve the speed of CakePHP applications.  The latest article (that was just released a few days ago) discusses creating your very own OAuth server.  Since OAuth2 is still in a draft state, the article is for creating an OAuth1 server.

In case you are not a regular of this site, here is a quick preview of the articles.

Read more >

Tags: CakePHP | php | PHP | oauth

CakePHP Global Constants and Functions

Published on Sep 21, 2012 by Jamie Munro

If you ever find yourself perusing some of the default code that comes with CakePHP, you might find yourself somewhat curious and confused when you see such functions as <?php e('Hello World');?> or <?pho echo h('<a href="">Hello World</a>');?>.

I know I certainly was and became determined to understand what the heck these were doing.  It quickly became apparent that these were just two of the many built-in extension functions that are part of the CakePHP framework!

Read more >

Tags: CakePHP | php

CakePHP 2.x Login System

Published on Sep 18, 2012 by Jamie Munro

A Short Rant About Coding Conventions

Published on Sep 13, 2012 by Jamie Munro

What I Learned This Summer

Published on Sep 7, 2012 by Jamie Munro

Officially published my CakePHP Book

Published on May 19, 2011 by Jamie Munro

AJAX Star Rating Plugin For CakePHP

Published on Mar 2, 2011 by Jamie Munro

Publishing an e-book on Smashwords

Published on Feb 7, 2011 by Jamie Munro

CakePHP 2.0 Rant Retraction

Published on Feb 1, 2011 by Jamie Munro

CakePHP 2.0 Rant

Published on Jan 31, 2011 by Jamie Munro

Using the TextHelper with CakePHP

Published on Jan 24, 2011 by Jamie Munro

Maintaining the back button with AJAX

Published on Dec 28, 2010 by Jamie Munro

Optimizing CakePHP Websites

Published on Jan 20, 2010 by Jamie Munro

Adding SEO functionality

Published on Nov 15, 2009 by Jamie Munro

unbindModel and $this->paginate()

Published on Aug 20, 2009 by Jamie Munro

Photobucket, Photos, and You

Published on May 23, 2009 by Jamie Munro

Facebook, Photos, and You!

Published on May 18, 2009 by Jamie Munro

Caching Queries in CakePHP

Published on Apr 25, 2009 by Jamie Munro

Custom pagination query in CakePHP

Published on Apr 13, 2009 by Jamie Munro

3 Flaws to CakePHP's AuthComponent

Published on Apr 10, 2009 by Jamie Munro

A friendly framework reminder

Published on Apr 1, 2009 by Jamie Munro

Unbind Model Validation in CakePHP

Published on Mar 28, 2009 by Jamie Munro

Re-map key/value array data in PHP

Published on Mar 19, 2009 by Jamie Munro

How to advance our CMS in CakePHP

Published on Mar 8, 2009 by Jamie Munro

How to create a CMS with CakePHP

Published on Mar 7, 2009 by Jamie Munro

AJAX Select box in CakePHP

Published on Mar 6, 2009 by Jamie Munro

How to setup a route in CakePHP

Published on Mar 5, 2009 by Jamie Munro

Why Frameworks Are Better

Published on Feb 17, 2009 by Jamie Munro