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

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
Router Session

Documentation generated on Mon, 21 May 2007 22:27:42 -0600 by phpDocumentor 1.3.2