The ArraySource is a read-only datasource for CakePHP's ORM which uses an array of records inside the Model classes. It was originally created by Juan Basso a couple of years ago. Since then it has been moved to the official CakePHP Datasources plugin and is compatible up to version 2.4.

It is pretty useful for things like statuses, genders or countries for example. These things are usually static and therefor ideal to move out of the database. Using the ArraySource you would still be able to use them in associations and they will be merged in when you do a find. It works with Containable as well. So it's a good replacement for ENUMs, which aren't supported by CakePHP.

Because the ArraySource uses the ORM to store the records you can always swap it out and use any other datasource like MySQL or PostgreSQL. Just place the records in your table and it becomes read/write without breaking anything. I sometimes fake a model first (similar to fixtures) and make a table later.

Another benefit of using the ArraySource is that you can translate the records in your code (with the __*() functions) instead of having to setup the Translate behavior. This means your development is even more rapid and you have versioning on your records.

Setup is really easy and works the same as any datasource. Clone the plugin into your plugins directory as "Datasources" and just add something like the following in your Config/database.php:

<?php
public $array = [
    'datasource' => 'Datasources.ArraySource'
];
?>

Now you can create an array model like this:

<?php
class OrderStatus extends AppModel {
    public $useDbConfig = 'array';
    public $hasMany = ['Order'];
    public $records = [
        ['id' => 1, 'name' => 'open'],
        ['id' => 2, 'name' => 'paid'],
        ['id' => 3, 'name' => 'shipped']
    ];
}
?>

You obviously need a belongsTo association in your Order model as well to query it correctly, but once you have that you can do anything you can do with a normal model as well. Except for SQL functions, real joins and writes of course. If you check the tests you can see some of the possibilities.