Skip to content

CakePHP 1.2alpha - model validation

I thought I was out of the woods. I upgraded my development copy of MacServ to the alpha version of CakePHP so I could make use of it’s pagination features; I tweaked my views to replace calls to various deprecated html helper functions with the new ones in the form helper, made one or two minor changes and thought I was good to go…

First thing this morning one of the engineers was having problems adding a new repair. It was obvious to me that the problem was due to not entering a required field but there no validation errors were being displayed, doh!

It turns out that model validation is specified in a completely different way in the 1.2.x.x branch and being an alpha release there is no “official” documentation. So I did what any geek would do: started reading through the API and newsgroup posts and after a short while was guided to this article. Just what I needed :)

It’s going to be a bit tedious making the required changes to all my models and views but from what I’ve seen so far I’m liking this version of CakePHP and wish I had settled on it in the first place instead of opting for the “stable” 1.1.x.x branch.

On a side note, the latest 1.2.x.x alpha was released today with the next release slated to be have beta status. I look forward to upgrading but I’m going to play it safe and ensure my app is working correctly before making any further changes to the version of the framework I’m using!

{ 4 } Comments

  1. pj | October 5, 2007 at 3:11 pm | Permalink

    Hey, found your site after spelunking from Matt’s infurious website. Thought you might find this amusing: I invented pagination in cake.

    (Well, not strictly speaking true, but I was certainly pushing damn hard for it: https://trac.cakephp.org/ticket/1 - course the pagination I started has since changed shape hundreds of times and I’ve had nothing to do with it. But still… funny, no? I had also submitted a pretty cool set of validation techniques but had to move onto drawing comics before I could really push them)

    - pj

  2. steve | October 5, 2007 at 3:53 pm | Permalink

    Thanks for stopping by PJ.

    The pagination code certainly made the lives of the lads at MacSys easier ;)

  3. pj | October 5, 2007 at 5:52 pm | Permalink

    Well, I’ll be - I didn’t know you guys were using it at all - I was asked to be project leader on Cake at one point, too, but comics was a-calling…

    I thought you guys were Ruby On Railsing it? Or is that one of Matt’s other companies? (It’s so hard to keep track…)

    pj

  4. steve | October 5, 2007 at 6:08 pm | Permalink

    Some of the other Infurious projects are using Rails. I’m not up to speed with it yet however, hence all the web apps I’ve done to date have made use of Cake.

Post a Comment

Your email is never published nor shared. Required fields are marked *