Show
Ignore:
Timestamp:
09/30/2007 08:10:04 PM (14 months ago)
Author:
xue
Message:

final fixes.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • tags/3.1.1/demos/quickstart/protected/pages/Database/ActiveRecord.page

    r2274 r2290  
    5151        <li>Lazy loading of relationships.</li> 
    5252    </ul> 
    53 <h2>Design Implications</h2> 
    54 <p> 
     53<h2 id="144003">Design Implications</h2> 
     54<p id="720007" class="block-content"> 
    5555Prado's implementation of Active Record does not maintain referential identity. Each object obtained using 
    5656Active Record is a copy of the data in the database. For example, If you ask for 
     
    5959comparison (i.e., using <tt>===</tt>) will return false, while loose comparison (i.e., using <tt>==</tt>) will 
    6060return true if the object values are equal by loose comparison. 
    61 <p> 
    62 <p> 
     61<p id="720008" class="block-content"> 
     62<p id="720009" class="block-content"> 
    6363This is design implication related to the following question. 
    6464<i>"Do you think of the customer as an object, of which there's only one, 
     
    10601060</p> 
    10611061 
    1062 <h2>Column Mapping</h2> 
    1063 <p> 
     1062<h2 id="144004">Column Mapping</h2> 
     1063<p id="720010" class="block-content"> 
    10641064Since v3.1.1, Active Record starts to support column mapping. Column mapping allows developers 
    10651065to address columns in Active Record using a more consistent naming convention. In particular, 
     
    10671067the name defined in the database schema. 
    10681068</p> 
    1069 <p> 
     1069<p id="720011" class="block-content"> 
    10701070To use column mapping, declare a static array named <tt>COLUMN_MAPPING</tt> in the Active Record class. 
    10711071The keys of the array are column names (called <i>physical column names</i>) as defined in the database 
     
    10941094} 
    10951095</com:TTextHighlighter> 
    1096 <p> 
     1096<p id="720012" class="block-content"> 
    10971097With the above column mapping, we can address <tt>first_name</tt> using <tt>$userRecord->firstName</tt> 
    10981098instead of <tt>$userRecord->first_name</tt>. This helps separation of logic and model.