Jun 29

CakePHP 1.2 RC2 is available!

The cake team is working rather quickly. They have released Cake 1.2 release candidate 2 on June 27th. Time to upgrade once again! The goodness just keeps coming.

Jun 16

Playing with Cake RC1

CakePHP RC1 was released on June 4th. At the moment I haven’t had much time to play with it as I wrap up a few projects using 1.2 beta. One thing I did notice was their inclusion of the Containable Behaviour. This is a powerful behaviour that helps in limiting the data you want to grab from your models. I’ve used both Mariano’s and Felix’s behaviours and I’m glad those forces were combined to produce this, and then some.

This weekend I’ll be upgrading my client sites to RC1 and hopefully all will go well. For information on what’s new in RC1, visit the bakery

Feb 28

CakePHP ACL Behavior modified

I’ve posted this up at the bakery, but articles seem to take awhile to get published. It could also be that they’re working on a new ACL Behavior, one can hope. For the time being, I’ve fixed up the core behavior and added a few features as well. I’ll just replicate here what I wrote at the bakery.

This Acl behavior makes a number of improvements from the built-in one. It allows you to have a model act as both an “Aro” and “Aco”. It creates an alias in this format “Model.id”. If parent node is not provided, it’ll create one based on root object. For example, if you create Post.1 as an ACO and you set parentNode to null, it’ll set the parent_id to the root “Post” Aco if it exists. So your tree would look like the following:

Acos
----------
Post
|-Post.1
|-Post.2
|-Post.3

Usage Instructions

Follow the following steps to use the Acl behavior.

Step 1

Copy the behavior class into a file named “acl.php” in your /app/models/behaviors folder.

Step 2

Load the behavior in the model you want to use it in.

Examples:

Ex 1: Act as Aco

var $actsAs = array('Acl' => array('Aco'));

Ex 2: Act as Aco

var $actsAs = array('Acl' => 'Aco');

Ex 3: Act as Aro

var $actsAs = array('Acl' => array('Aro'));

Ex 4: Act as Aro and Aco

var $actsAs = array('Acl' => array('Aro', 'Aco'));

Step 3

Create the method parentNode($type) in your model. This will return the parent_id to a method in the Acl behavior.

Here’s an example of a User model passing a group id as it’s parent id only for the ARO:

function parentNode($type)
{
if ($type == 'Aro') {
if (!$this->id) {
return null;
}
 
$data = $this->read();
 
if (!$data['User']['group_id']){
return null;
} else {
return array('model' => 'Group', 'foreign_key' => $data['User']['group_id']);
}
} else {
return false;
}
}

That’s it!
Download the behavior class here

Dec 29

CakePHP gives us xmas present :)

First and foremost, happy holidays everyone. T’is the season of giving and that’s just what CakePHP has done. On christmas day, CakePHP has released version 1.2.0.4206_dev and what a release it was! Although I have to try out these new promised features, I really like what the cake team has done. They have addressed some requests for the framework by putting in commonly used components into the cake core.

- A better validations class

- Improvements to the Form helper

- Pagination! Finally :)

- An email component

- Support for HTTP Auth

And a few other changes were made as well. While there are already existing components for paginaton, email, etc, made by the cake community, it’s good to see these cake supported components. They are such common components that I’d say most applications would rely on them and it’s good to have a framework with these features built-in.

Check out their official announcement at the cakephp website.

Have a happy new year everyone! I look forward to see the stable version of 1.2 in the new year

Dec 15

Why choose CakePHP

Here’s a pretty good article that Christine Anderssen of webpronews.com wrote on choosing cakePHP framework over other frameworks available out there.

The point is, the web developer is now really spoilt for choice. Which is a problem in itself, since having too much choice can leave you dithering between different options. This article is therefore about how I made my choice, which was CakePHP, and which factors I took into consideration.

Read the full article here.

Next Page ยป