[ Index ] |
|
Code source de PHPonTrax 2.6.6-svn |
1 <refentry id="{@id}" revision="$Id: Inflector.cls 195 2006-04-03 22:27:26Z haas $" revision="$Id: Inflector.cls 195 2006-04-03 22:27:26Z haas $"> 2 <refnamediv> 3 <refname>Inflector</refname> 4 <refpurpose>Implement the Trax naming convention</refpurpose> 5 </refnamediv> 6 <refsynopsisdiv> 7 <author> 8 Walt Haas 9 <authorblurb> 10 {@link mailto:haas@xmission.com haas@xmission.com} 11 </authorblurb> 12 </author> 13 </refsynopsisdiv> 14 {@toc} 15 <refsect1 id="{@id intro}"> 16 <title>Introduction</title> 17 <para>This class provides static methods to implement the 18 {@tutorial PHPonTrax/naming.pkg Trax naming convention}. 19 Inflector is never instantiated.</para> 20 </refsect1> 21 <refsect1 id="{@id examples}"> 22 <title>Conversion Examples</title> 23 <refsect2 id="{@id example_tableize}"> 24 <title>Find Table Name For This Class</title> 25 <example> 26 class OrderDetail extends ActiveRecord { 27 function __construct() { 28 $table_name = Inflector::tableize(get_class()); 29 // $table_name is now "order_details" 30 } 31 } 32 </example> 33 </refsect2> 34 <refsect2 id="{@id example_classify}"> 35 <title>Find Class Name For A Table</title> 36 <example> 37 $class_name = Inflector::classify("people"); 38 // $class_name is now "Person" 39 </example> 40 </refsect2> 41 <refsect2 id="{@id example_humanize}"> 42 <title>Generate User Friendly Description Of A Table</title> 43 <example> 44 $readable_name = Inflector::humanize("monthly_reports"); 45 // $readable_name is now "Monthly Reports" 46 </example> 47 </refsect2> 48 <refsect2 id="{@id example_classify}"> 49 <title>Find Foreign Key For A Class</title> 50 <example> 51 $key_name = Inflector::foreign_key("PartNumber"); 52 // $key_name is now "part_number_id" 53 </example> 54 </refsect2> 55 </refsect1> 56 <!-- 57 Local variables: 58 mode: xml 59 c-basic-offset: 1 60 indent-tabs-mode: nil 61 End: 62 --> 63 </refentry>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 20:04:38 2007 | par Balluche grâce à PHPXref 0.7 |