PHPonTrax
[ class tree: PHPonTrax ] [ index: PHPonTrax ] [ all elements ]
Prev Next
Inflector

Inflector

Implement the Trax naming convention

Table of Contents

Introduction

This class provides static methods to implement the Trax naming convention. Inflector is never instantiated.

Conversion Examples

Find Table Name For This Class

class OrderDetail extends ActiveRecord {
    function __construct() {
        $table_name = Inflector::tableize(get_class());
        //  $table_name is now "order_details"
    }
}

Find Class Name For A Table

$class_name = Inflector::classify("people");
//  $class_name is now "Person"

Generate User Friendly Description Of A Table

$readable_name = Inflector::humanize("monthly_reports");
//  $readable_name is now "Monthly Reports"

Find Foreign Key For A Class

$key_name = Inflector::foreign_key("PartNumber");
//  $key_name is now "part_number_id"

Prev   Next
Session ActiveRecordError

Documentation generated on Thu, 04 May 2006 19:46:56 -0600 by phpDocumentor 1.3.0RC4