- Timestamp:
- 09/30/2007 08:10:04 PM (14 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
tags/3.1.1/demos/quickstart/protected/pages/Database/ActiveRecord.page
r2274 r2290 51 51 <li>Lazy loading of relationships.</li> 52 52 </ul> 53 <h2 >Design Implications</h2>54 <p >53 <h2 id="144003">Design Implications</h2> 54 <p id="720007" class="block-content"> 55 55 Prado's implementation of Active Record does not maintain referential identity. Each object obtained using 56 56 Active Record is a copy of the data in the database. For example, If you ask for … … 59 59 comparison (i.e., using <tt>===</tt>) will return false, while loose comparison (i.e., using <tt>==</tt>) will 60 60 return 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"> 63 63 This is design implication related to the following question. 64 64 <i>"Do you think of the customer as an object, of which there's only one, … … 1060 1060 </p> 1061 1061 1062 <h2 >Column Mapping</h2>1063 <p >1062 <h2 id="144004">Column Mapping</h2> 1063 <p id="720010" class="block-content"> 1064 1064 Since v3.1.1, Active Record starts to support column mapping. Column mapping allows developers 1065 1065 to address columns in Active Record using a more consistent naming convention. In particular, … … 1067 1067 the name defined in the database schema. 1068 1068 </p> 1069 <p >1069 <p id="720011" class="block-content"> 1070 1070 To use column mapping, declare a static array named <tt>COLUMN_MAPPING</tt> in the Active Record class. 1071 1071 The keys of the array are column names (called <i>physical column names</i>) as defined in the database … … 1094 1094 } 1095 1095 </com:TTextHighlighter> 1096 <p >1096 <p id="720012" class="block-content"> 1097 1097 With the above column mapping, we can address <tt>first_name</tt> using <tt>$userRecord->firstName</tt> 1098 1098 instead of <tt>$userRecord->first_name</tt>. This helps separation of logic and model.
