Things tagged with CakePHP
Cake PHP framework
-
How I debug PHP errors and issues
Jun 25 2009
I spend a lot of time in various IRC channels answering questions and helping out, and one recurring theme that pops up again and again is people not knowing what to do when things go wrong. Whether it be a simple error or a logical mixup, people often lack the tools or processes to figure things out. So I thought I would share how I approach errors and problems.
-
Simplifying Controller logic with Exceptions
Jun 12 2009
In the ongoing struggle against code bloat and creative ways to do things, I’ve been playing with throwing exceptions from model methods. While not earth shattering stuff, I’ve found it to have a few advantages over returning
false. First, you can end up with lessifandelsestatements. -
5 signals that can indicate its time to re-factor
May 31 2009
Re-factoring code is a part of any programmers life or should be. Very few people write beautifully clean and well factored code from the start, and I am certainly not one of them. Most times my code starts out a sprawling tangle that takes an additional pass or two to look like something I would consider clean. I find that when programming and designing I start with a rough idea or sketch of what I want to accomplish.
-
DebugKit 1.1 Released
May 16 2009
Today marks the 1.1 release of DebugKit. After using it for the past few weeks and not finding any new issues or getting and new tickets. A few new features snuck into the release, courtesy of Andy Dawson.
-
Extending DebugKit - The new Javascript features
May 14 2009
Hopefully by now you’ve used DebugKit , and found it to be as useful as I do. If you’ve ever wanted to add a new panel, you can and its actually quite easy to do.
-
Year one of baking CakePHP
May 06 2009
Today is the one year anniversary of my first commit to CakePHP, amazing how time flies. It seems not too long ago that gwoo and nate approached me to join the core team and help with writing the tests for 1.2. What started with test cases soon bloomed into full blown commit access and had me working on all parts of the core. Year one also saw the creation of DebugKit which is nearing its 1.
-
Calculating Documentation Coverage with ApiGenerator
Apr 26 2009
Generating code coverage for test cases is a handy feature, it gives you a quick and easy way to determine how much of your code is running during your tests. It doesn’t ensure that the tests are good or that you have enough assertions, but code that doesn’t run definitely has not been tested. Before code coverage was created it was very difficult to determine how much code was being run.
-
Creating Deployment ready Javascript with Sprockets
Apr 02 2009
If you’ve ever worked on a medium to large Ajax application, you know the headaches that Javascript can give you. On one hand you want to serve as few as possible Javascript files to users, but on the other you want to keep your sanity and work with lots of smaller files. This is where a build process comes in. It allows you to transform lots of files into one big file! You can even minify the big file for additional savings.
-
CakeFest Berlin 2009 Badges
-
New features brewing for DebugKit 1.1
Mar 26 2009
So I’ve been working away on DebugKit the last few weeks. And I think its at a level where I can suggest other people give it a whirl. Its not at a stable release point. But if you are feeling adventurous and don’t mind using beta code give it a try. There are a few notable features have been added, so in no particular order here they are.
-
Generating vCards with CakePHP using extensions
Mar 20 2009
vCards are a nice added touch for an application that acts as a Address book, or contact management. vCards are easily used by most mail clients, and are a plain text standard making them nice and easy to implement. While hCard and other microformats are gaining popularity, the widespread support still doesn’t exist. Leaving vCard as the primary format to transfer contact information out of a web application
-
Running CakePHP Unit Tests with TextMate
Mar 09 2009
As most people know TextMate is a pretty amazing text editor, probably one of the best for MacOS. What you may not know is that CakePHP has its own textmate bundle. this bundle is maintained by Joël Perras who is also a recent addition to the CakePHP core team.
-
Making a global plugins directory for CakePHP
Mar 02 2009
This is a quick trick I learned from master baker gwoo. If by chance you have multiple projects, and those projects share multiple plugins. You are in a bit of a pickle.
-
Using ApiGenerator to generate documentation
Feb 12 2009
The release of the new API at http://api.cakephp.org wasn’t quite as smooth as I would have liked it. However, since the initial release things have constantly been improving. The search is now much more effective, and global functions are now in the index. So things are looking better each day. I hope to answer a few questions surrounding ApiGenerator today.
-
New home for DebugKit
Feb 04 2009
Well its been a while coming but today, DebugKit officially left GitHub. As noted in the past by some, the CakePHP family of projects were a bit scattered. So in an effort to consolidate everything, DebugKit has moved over to thechaw alongside other fabulous CakePHP projects like CakeBook and ApiGenerator.
-
The new face of CakePHP's API
Jan 27 2009
If you’ve been to the http://api.cakephp.org today you may have noticed a few changes. First its no longer powered by doxygen. Doxygen has been giving us a few headaches in the last few months. So gwoo and myself have taken it upon ourselves to write our own Api generation tool. We called it ApiGenerator you can see it running at api.cakephp.org.
-
Testing CakePHP controllers - Mock Objects edition
Jan 21 2009
I recently wrote an article about testing CakePHP controllers the hard way where I covered testing controllers by running their methods manually. I hinted at some additional tricks that could be performed by using Mock Objects. Today I’m going to spill the beans on Mocks, and how I use them when testing my Controllers.
-
Paginating long lists in the CakePHP Console
Jan 16 2009
I’ve recently been doing some work on some CLI tools, and I came across the need to “paginate” a long list of file. Instead of dumping out 40+ items to the screen all at once, which would be confusing and hard to read, I wanted a more elegant way of showing only a section on the huge list at once.
-
CakePHP test suite icons part 2
-
CakePHP RC4 released
Dec 19 2008
Earlier this evening the last 300 changes to CakePHP were merged into the trunk forming CakePHP RC4. It should be a painless update for all, and it brings us one step closer to a final stable release of 1.2, something we all look forward to.
-
Testing CakePHP Controllers the hard way
Dec 18 2008
By now you already know or should know about
CakeTestCase::testAction()and the wondrous things it can do. However,testActionhas a few shortcomings. It can’t handle redirects, it doesn’t let you use the power of Mocks, and its impossible to make assertions on object state changes. Sometimes you need to do things the hard way, stick your fingers in the mud and work it out. -
DebugKit updates
Dec 13 2008
I’ve been working hard over the last few weeks to improve the DebugKit and have added what I think are some pretty cool features. First up is
FireCake.FireCakeis a fully functional FirePHP library built specifically with CakePHP in mind. -
Free slides - CakeFest Argentina
Dec 10 2008
I’ve uploaded the slides from the talks I gave at CakeFest Argentina. Both unit test talks are one file, as that is how it was originally written. You can find them in my Downloads area. Hope you enjoy.
-
Unit Testing : CakeFest Argentina
Dec 10 2008
These slides were used in a 2 part talk given at CakeFest Argentina on unit testing in CakePHP
-
Plugin Development : CakeFest Argentina
Dec 10 2008
These are the slides for a talk I gave at CakeFest : Buenos Aires on plugin development.
-
CakeFest Argentina after thoughts.
Dec 07 2008
Well I’m finally back in Canada after a somewhat hairy experience at JFK airport in New York, I’m home in the great white north. I had an awesome time at CakeFest and would like to thank all the sponsors and all the people who came out. It was a really great experience for me, and a pleasure to finally be able to put faces to the names and lines of text/code speak to / read each day.
-
CakeFest argentina approaches
Nov 28 2008
Cakefest 2 Argentina is quickly approaching. If you are sitting on the fence on going until the last minute then get off and come on down. Its going to be a good time with lots of great talks. I’ll even be there! I’m giving two talks one on Unit Testing and the other on plugin development. Hope to see you there.
To find out more about Cakefest follow the link.
-
Making Testable Static classes
Nov 21 2008
If you’ve ever tried to subclass a PHP4 static class you may have come to same conclusion that I have its a total pain in the neck. However, I think I’ve come up with a not too terrible approach.
-
Using bindModel to get to deep relations
Nov 14 2008
Often times you will need to query a distant table based on a condition on a close table. For example we have a store that has a table structure like the following:

Now we want to find the Division that a particular Item belongs to. In normal SQL we could do
-
New home, new sideproject
Nov 04 2008
I’ve had quite the busy last little month or two. My wife and I have been house shopping for a while, and found a place about 2 months ago. However, just last weekend we moved into our new (to us at least) condo in west Toronto.
The new sideproject is the CakePHP DebugKit . I’ve been hard at work building a ‘debug toolbar’ for CakePHP.
-
Using bitmasks to indicate status
Oct 25 2008
At some point or another we’ve all had to make a data model that involved various flags to indicate different statuses / modes for an object. Often the schema for such a data model may end up looking like
-
AclExtras Shell
Oct 18 2008
With the help of Oscar Carlsson I’ve updated the AcoSync Shell and renamed it to the AclExtrasShell. With Oscar’s help we’ve added quick and easy ways to recover and verify your tree structures. AclExtras Shell also incorporates all the existing functionality of AcoSync Shell.
-
Getting a new Oven, Migrating from CakePHP 1.1 to 1.2
Oct 11 2008
So 1.2 is nearly complete, the code is frozen and there are only a few bugs left to squash before the final release is ready. So you want to upgrade your application from 1.1 to 1.2. Although the 1.2 moniker suggests a ‘minor’ version, a lot has changed under the hood and entire API’s have been rebuilt.
-
Code Completion for CakePHP in Eclipse
Oct 04 2008
Eclipse is widely popular, robust and powerful IDE. It supports PHP through the PDT project . PDT gives you some good PHP related development tools, including code completion & code templates to help you save some time.
-
CakePHP RC3 released and CakePHP 1.1 new release
Oct 02 2008
If you are following the development of CakePHP today is a good day for you. RC3 was released today! We have all been working really hard to make this Release Candidate better than the last one. There have been over 400 commits since the last RC2. Some of the big changes are related to performance. Larry Masters and the rest of the team have been hard at work making CakePHP snappier and all around speedier.
-
Book Review: CakePHP Application Development
Sep 28 2008
The folks at Packt Publishing were kind enough to send me a copy of their newly published book CakePHP Application Development to review. The book is authored by Ahsanul Bari and Anupom Syam, and is a quick read at 300 pages.
-
Providing Contextual Form Help with Mootools
Sep 25 2008
I like many webdevelopers build a lot of forms. Forms are the bread and butter of web applications, and while making forms is getting easier for developers, users often still have a hard time with them. In these circumstances it is necessary to give them a help above and beyond ‘password’.
-
Acl Menu Component
Sep 13 2008
By now you’ve got an awesome Acl and Auth controlled app running. However, making navigation menus is a pain with dynamic, and variable permissions. Outside of making menu elements for each type of Aro and including them in your layout, there currently aren’t many options (at least none that I’m aware of). I was faced with this exact problem a while back, and couldn’t find a suitable solution, so I made one.
-
Auth and Acl - Automatically updating user Aros
Sep 07 2008
In my previous Auth and Acl tutorial I mentioned that I wasn’t including a way for users ARO to be automatically updated when a User’s group was updated. Well ‘hepper’ posted a patch to the
AclBehaviorin the comments to that article. -
CakePHP Easter eggs
Sep 03 2008
The documentation for CakePHP has grown in leaps and bounds since the creation of the cookbook. Today I wanted to look at a few methods and conventions that may not be crystal clear from reading the book or api.
Object::_set().
Object is the parent class for almost all other classes in CakePHP.
-
CakePHP Test suite icons
-
Anatomy of a CakePHP Test Case
Aug 23 2008
With all the talk of testing going on, I thought it would be good to look at how tests work and what is makes them tick. SimpleTest handles the bulk of test case execution, however, there are a few CakePHP specifics that are not part of a normal
SimpleTest::UnitTestCase. -
Reducing requestAction() use in your CakePHP sites with fat models
Aug 15 2008
When bakers first start using CakePHP there is a tendency to use
requestAction()more often than it should be. OftenrequestAction()gets used to pull in common elements like recent posts or new comments, or to make menus. This makes sense in a way as it keeps the comments code in theCommentsControllerand all is well. -
Session debugging in CakePHP
Aug 09 2008
Often on IRC and the CakePHP google group, I hear people asking how to get values out of the Session or how to find out what is currently in the Session. Generally this is connected to AuthComponent, which is can be complicated component. However, some simple ‘crude’ PHP tactics can make the “whats’s in my session?” question very simple.
-
Generate ACO records for your controllers and actions with AcoSyncShell
Aug 01 2008
Continuing in my previous vein of ACL related topics. I’ve got another handy addition to the ACL user’s toolbox.
-
Aco Sync Shell for CakePHP
Aug 01 2008
A CakePHP shell to automate the creation and syncing of ACO's generated from an application's controllers and actions.
-
Quick and dirty 'Down for Maintenance' page with CakePHP
Jul 25 2008
Websites need maintenance, and sometimes that maintenance requires the site to go down for a little bit as you tweak the database, add additional capacity or make large changes to the application code. In these circumstances you cannot afford to have users mucking about on your application. However, you might need access to ensure all your amazing upgrades go smoothly or perhaps do the upgrading inside the application itself.
-
Auth and ACL an end to end tutorial pt.2
Jul 13 2008
If you are looking for part one go here
In the last article we created the basic models, controllers and views for our Auth and Acl controlled app as well as initialized the Acl tables. We also bound our groups and users to the Acl through the use of the
AclBehavior. -
Auth and ACL an end to end tutorial pt. 1
Jul 07 2008
Now, there are many tutorials out there for Auth and ACL in CakePHP. However, none of them (as far as I know of) cover putting together Auth and ACL from beginning to end. That is what I’m going to do in this article. I am splitting the article into two parts; the first about setting up our app and getting the Aros running, the second on building Acos and putting it all together.
-
Introducing the Webservice Behavior
Jul 04 2008
As webservices grow so does the need for being able to communicate with them in an easy fashion. This simple blog alone uses 2 webservices. The recent tracks at the bottom is a feed I pull from Last.fm and my spam protection is provided by Akismet. When first building my site I looked for an already built solution and found a partial solution in Felix Geisendörfer’s WebModel.
-
Webservice Behavior
Jul 04 2008
A Model behavior and test case for use with CakePHP 1.2
-
More dogfood
Jun 29 2008
Well I just got back from a wonderful 2 week vacation of europe. My wife and I went to Amsterdam, Rome and Paris, for an art-geekout. We went to every museum we could and saw tons of beautiful works that really need to be seen in the stone and paint. We took tons of photos and I hopefully will find the time to do some painting based on them in the upcoming months.
-
Eating my own dogfood Upgrading to CakePHP RC1
Jun 13 2008
Well today I took the time to upgrade to CakePHP 1.2 RC1 in the spirit of ‘eating your own dogfood’. I got the usual warnings about
vendor()being deprecated. I also took the time to switch over all my Bindable calls to the fresh core Containable Behavior. Which for the most part consisted of changingrestrict()calls tocontain()calls. -
CakePHP RC1 released
Jun 05 2008
Earlier today a CakePHP 1.2 RC1 was released. You can read the full changelog
or read the official announcement to learn about whats been going on since the beta. Also download a new Cake and smell the fresh icing. -
Contributing to your first open source project.
May 24 2008
I was recently asked to join the development team at CakePHP a position I graciously and excitedly accepted. And although I’m still a bit wet behind the ears, I thought I would share some of my experiences in how you can get involved with Open Source Software.
-
Hacking the CakePHP FormHelper Adding Required Indicators
May 14 2008
Indicating to the user which fields are required is something that increases usuability, helping the user fill out the form more effectively and efficiently. These visual cues have absolutely nothing to do with the structure of the document, and would best be handled by CSS.
-
Code Coverage in CakePHP 1.2 Test Suite
Apr 30 2008
Super fresh in the SVN builds of CakePHP 1.2 is the new code coverage analysis. If you are living on the bleeding edge of cake development or just want a preview of the neat things to come once 1.2 is complete read on.
The guys at debuggable have contributed a fantastic tool to the testing suite for CakePHP 1.2.
-
Hacking the Form Helper and Editing Multiple Rows with CakePHP 1.1
Apr 26 2008
CakePHP 1.2 is a fantastic improvement over 1.1. However like many, my work has a stable release only policy. So I’m stuck using 1.1 at work for the time being. But after drinking the 1.2 juice, 1.1 is missing some of the potent automagic flavours. First up editing multiple rows in models. The stock syntax is lacking in that it doesn’t support this at all.
-
Understanding MVC and CakePHP
Apr 20 2008
Continuing with the trend of CakePHP information here, I’m going to cover some of the acronyms and lexicon of CakePHP. I hang out a lot on #cakephp and there are repeating trends in some of the questions that get asked so hopefully I can answer some of those questions here. As well as provide a bit of my personal experiences.
-
Fancy routing examples with CakePHP 1.2
Apr 15 2008
Routing in CakePHP is quite flexible in how you can route your urls to your controllers and actions. Offering both variable replacement and regex routing. You can route almost any parameter that is set by dispatcher and more. So lets try a few of these.
-
Geshi Helper for CakePHP
Apr 05 2008
GeSHi or the Generic Syntax Highlighter is a simple yet powerful syntax highlighter for many languages. Implemented in many CMS. When I wanted syntax highlighting for my postings I decided to implement GeSHi. I wanted to share my implementation of GeSHi as a CakePHP helper.
-
Geshi Helper
Apr 05 2008
A Helper Class for CakePHP providing an easy to use interface for the GeSHi syntax highlighter. Read more at geshi helper for CakePHP
-
Creating RSS feeds with CakePHP and extensionless routing
Mar 28 2008
Making RSS feeds and alternative content types other than HTML opens a lot of options in how your content can be used, displayed and combined. In prior version of cakePHP webservices were indicated by prefixing a url with the desired content type so an xml version of a blog index might look like
xml/posts/index. -
Relaunch!
Mar 24 2008
Well the redesign and rebuild is complete. I’ve gutted my site and rebuilt it from the ground up. There are more changes than just a shiny new design though. With this redesign I’m shifting the focus of the site around a bit as well. -
Changes, they are a comin
Dec 29 2007
Well Merry Christmas and Happy New Year to everyone. I’ve been busy as always and have put up a new character painting in the Digital Section. This is the first painting that I’ve done in Photoshop that is approaching the quality and feel of my oil work. As time is always at a premium these days, I will probably be doing a few more digital paintings. They are easier and less fussy to work on than oils.
Search
Recent Posts
- How I debug PHP errors and issues
- Simplifying Controller logic with Exceptions
- 5 signals that can indicate its time to re-factor
- Using the PHP Reflection API for fun and profit
- DebugKit 1.1 Released
- Extending DebugKit - The new Javascript features
- Year one of baking CakePHP
- Calculating Documentation Coverage with ApiGenerator
- Speed up javascript event handling with event delegation and bubbling
- Creating Deployment ready Javascript with Sprockets
