PacktLib: CakePHP 1.3 Application Development Cookbook

CakePHP 1.3 Application Development Cookbook

Credits

About the Author

About the Reviewers

www.PacktPub.com

Preface

Authentication

Introduction

Setting up a basic authentication system

Using and configuring the Auth component

Allowing logins with username or e-mail

Saving the user details after login

Getting the current user's information

Using prefixes for role-based access control

Setting up Access Control Layer-based authentication

Integrating with OpenID

Model Bindings

Introduction

Adding Containable to all models

Limiting the bindings returned in a find

Modifying binding parameters for a find

Modifying binding conditions for a find

Changing the JOIN type of one-to-one associations

Defining multiple associations to the same model

Adding bindings on the fly

Pushing the Search

Introduction

Performing GROUP and COUNT queries

Using virtual fields

Building queries with ad-hoc JOINs

Searching for all items that match search terms

Implementing a custom find type

Paginating a custom find type

Implementing AJAX based pagination

Validation and Behaviors

Introduction

Adding multiple validation rules

Creating a custom validation rule

Using callbacks in behaviors

Using behaviors to add new fields for saving

Using the Sluggable behavior

Geocoding addresses with the Geocodable behavior

Datasources

Introduction

Improving the SQL datasource query log

Parsing CSV files with a datasource

Consuming RSS feeds with a datasource

Building a Twitter datasource

Adding transaction and locking support to the MySQL datasource

Routing Magic

Introduction

Using named and GET parameters

Using routes with prefixes

Working with route elements

Adding catch-all routes for profile pages

Adding validation for catch-all routes

Creating custom Route classes

Creating and Consuming Web Services

Introduction

Creating an RSS feed

Consuming a JSON service

Building REST services with JSON

Adding authentication to REST services

Implementing token-based authorization for API access

Working with Shells

Introduction

Building and running a shell

Parsing command line parameters

Creating reusable shell tasks

Sending e-mails from shells

Non-interactive tasks with the robot plugin

Internationalizing Applications

Introduction

Internationalizing controller and view texts

Internationalizing model validation messages

Translating strings with dynamic content

Setting and remembering the language

Testing

Introduction

Setting up the test framework

Creating fixtures and testing model methods

Testing controller actions and their views

Using mocks to test controllers

Running tests from the command line

Utility Classes and Tools

Introduction

Working with the Set class

Manipulating strings with the String class

Sending an e-mail

Detecting file types with MagicDb

Throwing and handling exceptions