A Weblog written, styled and hacked by Joel Moss
Last month I read - more like scanned - over a post on Felix Geisendörfer’s (the_undefined) blog all about a new behaviour he had just written for CakePHP. At the time I didn’t really get it and so didn’t see its value. But today while progressing with my Cake rewrite of Switchboard, I had a need to limit the associations that Cake was returning. The most obvious way was to play with the $recursive variable in my models, but that just isn’t fine grained enough. So I hopped on over to the Cake IRC channel and asked how others were doing it. Luckily for me, Felix had also hopped on over and suggested I take a look at his containable behaviour. He had just released version 2.0, so I grabbed the code and started playing.
Why the hell didn’t I ever use this before? It has solved all my association problems and is so damn easy to use. Just stop what you are doing right now and get his code and add the behaviour to your cake apps. I promise you that you will never look back.
Core team, if you are reading this then you have to put this in the core.
My name is Joel Moss, a web developer and all round nice guy, living in Manchester, England. I am currently working full time for ShermansTravel.com, but I fill whatever spare time I have with lots of good and wholesome "stuff"! Like developing my own ideas; such as Tooum, contributing to the excellent CakePHP framework, and doing more work for ShermansTravel.
So this is my blog - my soap box! Here I attempt to share my likes, my dislikes, and my opinions. As well as providing some occasional respite from the daily crap we all endure. Enjoy ;)
Hey, if you want to reach me, i'm available via email:joel[at]developwithstyle[dot]com, and AIM:joelkmoss.
Leave a reply