Junal on the run

Experience with CakePHP 1.2 (pre-beta version)

Posted on: November 2, 2007

Its been few days since CakePHP 1.2 pre-beta version released! Couldn’t wait to use it as I got an opportunity to develop an online booking system.  There are lots of changes in 1.2 comparing 1.1 version.  If you used CakePHP 1.1 and thinking to use CakePHP 1.2 then you should have a look what’s new in Cake 1.2 here: http://cakebaker.42dh.com/2007/04/05/whats-new-in-cakephp-12/

I faced some problems to work with pre-beta version as all documentations still not released. Hope full documentation will have proper explanation of the problems that I faced.

But there are lots of improvements in 1.2 some new components have been added which is really helpful. As an example Email component, Pagination component, and validation is stronger now [i.e. multiple validation]. HTML helper, FORM helper, NUMBER helper and TIME helper are must stronger now. Im sure it will make life easier for  developers. To get more ideas about all these helpers you better visit here:  http://www.donutczar.com/cake1point2/donuts/

I hope these above link example will help you to reduce your confusion of new changes. These all example shows what things changes from Cake 1.1

A problem might arise with customize label. Cake new version adds your label smartly once you mention your field name: Model.field_name  <-it assumes your field name will be your label name so it just convert your field_name into Field Name. You shouldn’t allow Cake to give your label name automatically. You better use it this way..

<?php echo $form->input(‘Login.phone’, array(‘label’ => ”));?>

 So you are telling that label is null and now you can put your own customize label using html label tag.

New cake got lots of built-in validations rules which are really great.

Built-in rules are:

  • alphaNumeric: allows alphabets and numbers on
  • between: limits the length of data between certain range
  • minLength: limits the minimum length
  • maxLength: limits the maximum length
  • date: checks valid date
  • decimal: checks for a valid decimal number
  • email: checks for a valid email address
  • numeric: allows numbers only
  • url: used to validate urls

 im sure you will enjoy these built-in functionalities. I have used almost all of these. But be aware to use “email” validation rule! It includes only few domain name and except that it says “Invalid email”!! but junal@iub.edu.bd is a right email address right ? To add more domain name in the list you should follow this:  you_project_name\cake\libs \validation.php

Find line # 43 and 449 then added more domain name to allow them to be valid. On the other hand if you use VALID_EMAIL rule you will get a message like  “this field cannot be empty” but this is not the right message for and invalid email right ? So you better use customize validation rule this way:

It takes a regular

Expression as a parameter, and checks if the data is of the same pattern or


var $validate = array(

‘login’ => array(

‘rule’ => array(‘custom’, ‘/[a-z0-9]{3,}$/i’),

‘message’ => ‘Only letters and integers, min 3 characters’



Well another thing I must mention that I faced problem with persistence shit when I was gonna up the project in the real server.  It was showing this bellow message

Warning (2): loadcomponent(D:\apache\htdocs\sample\cake\libs\controller\components\session.php) [function.loadcomponent]:

and I didn’t have any clue where I did use this absolute path ?? And why the hell this local path is showing here??? Then I found this persistent folder which is keeping this class.paths.php file.

So don’t forget to clean you cache before you up your project in the real sever!

Ok that was nice experience with Cake latest version. I will write more with latest version once I get chance to play with these new features 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

View Junal Rahman's profile on LinkedIn
Subscribe to me on FriendFeed

Follow Me on Twitter


My photos

Blog Stats

  • 424,735 hits
%d bloggers like this: