Changeset 1902
- Timestamp:
- 05/06/2007 11:17:37 PM (20 months ago)
- Location:
- trunk
- Files:
-
- 1 added
- 32 modified
-
UPGRADE (modified) (1 diff)
-
build.xml (modified) (6 diffs)
-
buildscripts/chmbuilder/ChmQuickstartBuilder.php (modified) (4 diffs)
-
buildscripts/chmbuilder/build.php (modified) (1 diff)
-
buildscripts/chmbuilder/chm_style.css (modified) (1 diff)
-
buildscripts/phing/tasks/PradoQuickStartDocs.php (added)
-
buildscripts/texbuilder/Page2Tex.php (modified) (2 diffs)
-
buildscripts/texbuilder/quickstart/build.php (modified) (1 diff)
-
demos/quickstart/protected/pages/Advanced/Performance.page (modified) (1 diff)
-
demos/quickstart/protected/pages/Advanced/Scripts3.page (modified) (2 diffs)
-
demos/quickstart/protected/pages/Configurations/Templates1.page (modified) (1 diff)
-
demos/quickstart/protected/pages/Controls/Validation.page (modified) (2 diffs)
-
demos/quickstart/protected/pages/Database/ActiveRecord.page (modified) (32 diffs)
-
demos/quickstart/protected/pages/Database/Scaffold.page (modified) (12 diffs)
-
demos/quickstart/protected/pages/GettingStarted/AboutPrado.page (modified) (1 diff)
-
demos/quickstart/protected/pages/GettingStarted/Introduction.page (modified) (5 diffs)
-
demos/quickstart/protected/pages/GettingStarted/NewFeatures.page (modified) (1 diff)
-
demos/quickstart/protected/pages/Services/SoapService.page (modified) (1 diff)
-
demos/quickstart/protected/pages/Tutorial/AddressBook.page (modified) (1 diff)
-
demos/quickstart/themes/PradoSoft/style.css (modified) (1 diff)
-
framework/Data/ActiveRecord/Relations/TActiveRecordBelongsTo.php (modified) (1 diff)
-
framework/Data/ActiveRecord/Relations/TActiveRecordHasManyAssociation.php (modified) (8 diffs)
-
framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php (modified) (1 diff)
-
framework/Data/ActiveRecord/Relations/TActiveRecordRelationContext.php (modified) (3 diffs)
-
framework/Data/ActiveRecord/TActiveRecord.php (modified) (3 diffs)
-
framework/Data/ActiveRecord/TActiveRecordGateway.php (modified) (1 diff)
-
framework/Data/Common/Sqlite/TSqliteMetaData.php (modified) (1 diff)
-
framework/Data/DataGateway/TDataGatewayCommand.php (modified) (1 diff)
-
framework/Data/DataGateway/TTableGateway.php (modified) (4 diffs)
-
tests/simple_unit/ActiveRecord/FindBySqlTestCase.php (modified) (2 diffs)
-
tests/simple_unit/ActiveRecord/ForeignObjectUpdateTest.php (modified) (4 diffs)
-
tests/simple_unit/DbCommon/SqliteColumnTest.php (modified) (3 diffs)
-
tests/simple_unit/TableGateway/TableGatewayPgsqlTest.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/UPGRADE
r1892 r1902 18 18 - Comment tag <!-- ... ---> (introduced in v3.1a) is changed to <!--- ... ---> 19 19 - When TDataList.RepeatLayout is Raw, the items will render <div> instead of <span> 20 20 21 - TActiveRecord finder methods will always return a new object instance (identity mapping was removed). 22 - TActiveRecord::findBySql() will return an object rather than an array 23 - TActiveRecord::findAllBySql() will return an array of objects. 21 24 22 25 Upgrading from v3.1a -
trunk/build.xml
r1901 r1902 15 15 <!-- <taskdef name="prado-test" classname="PradoTestTask" classpath="buildscripts/phing/tasks"/>--> 16 16 <taskdef name="compact-package" classname="PradoPackageTask" classpath="buildscripts/phing/tasks"/> 17 <taskdef name="prado-quickstart-docs" classname="PradoQuickStartDocs" classpath="buildscripts/phing/tasks" /> 17 18 18 19 <!-- generates ${prado.version} and ${prado.revision} --> … … 151 152 </target> 152 153 154 153 155 <!-- bulid compact prado package definitions --> 154 156 155 157 <target name="compact-collections" description="Collections"> 156 158 <mkdir dir="${build.compact.dir}" /> 159 <mkdir dir="${build.compact.dir}/docs" /> 157 160 <compact-package output="${build.compact.dir}/collections.php" strip="${compact-strip-comments}"> 158 161 <filelist dir="framework" files="PradoBase.php,TComponent.php,Exceptions/TException.php,interfaces.php" /> … … 164 167 <copy file="HISTORY" tofile="${build.compact.dir}/HISTORY" /> 165 168 <delete file="${build.compact.dir}/readme.txt" /> 166 <append text="PRADO Framework for PHP 5, version ${prado.version}. See http://www.pradosoft.com/ for Documentation."169 <append text="PRADO Framework for PHP 5, version ${prado.version}. See docs/ directory for documentation." 167 170 destFile="${build.compact.dir}/readme.txt" /> 171 172 <prado-quickstart-docs output="${build.compact.dir}/docs" 173 pages="Advanced/Collections.page,Fundamentals/Components.page"/> 168 174 </target> 169 175 … … 175 181 files="TDbTableInfo.php, TDbTableColumn.php, TDbCommandBuilder.php, TDbMetaData.php" /> 176 182 </compact-package> 183 <prado-quickstart-docs output="${build.compact.dir}/docs" pages="Database/DAO.page" /> 177 184 </target> 178 185 … … 224 231 <append file="framework/Data/ActiveRecord/Exceptions/messages.txt" 225 232 destfile="${build.compact.dir}/messages.txt" /> 233 <prado-quickstart-docs output="${build.compact.dir}/docs" pages="Database/ActiveRecord.page" /> 226 234 </target> 227 235 … … 238 246 <append file="framework/Data/SqlMap/DataMapper/messages.txt" 239 247 destfile="${build.compact.dir}/messages.txt" /> 248 <prado-quickstart-docs output="${build.compact.dir}/docs" pages="Database/SqlMap.page" /> 240 249 </target> 241 250 -
trunk/buildscripts/chmbuilder/ChmQuickstartBuilder.php
r1826 r1902 14 14 { 15 15 $this->base = $base; 16 $this->output_dir = $output .'/quickstart';17 18 if(!is_dir($this->output_dir) )19 { 20 mkdir($this->output_dir);21 mkdir($this->output_dir.'/assets/');16 $this->output_dir = $output; 17 18 if(!is_dir($this->output_dir) || !is_dir($this->output_dir.'/assets')) 19 { 20 @mkdir($this->output_dir); 21 @mkdir($this->output_dir.'/assets/'); 22 22 copy(dirname(__FILE__).'/chm_style.css', $this->output_dir.'/assets/chm_style.css'); 23 23 } … … 59 59 } 60 60 61 p rotectedfunction getApplicationContent()61 public function getApplicationContent() 62 62 { 63 63 ob_start(); … … 69 69 } 70 70 71 p rotectedfunction parseHtmlContent($content)71 public function parseHtmlContent($content) 72 72 { 73 73 $html = preg_replace('/<input.*name="PRADO_PAGESTATE" [^>]+\/>/m', '', $content); … … 90 90 $html = str_replace('http://www.pradosoft.com/docs/manual', '../manual/CHMdefaultConverter', $html); 91 91 $html = str_replace('target="_blank">View Source', '>View Source', $html); 92 $html = preg_replace('/action="[^"]+"/', '', $html); 93 $html = preg_replace('/<script[^>]+><\/script>/', '', $html); //remove js 94 $html = preg_replace('/href="C:[^"]+"/', 'href="#"', $html); 95 92 96 $html = preg_replace_callback('/href="\?page=ViewSource&(amp;){0,1}path=([a-zA-z0-9\.\/]+)"/', 93 97 array($this, 'update_source_url'), $html); -
trunk/buildscripts/chmbuilder/build.php
r1620 r1902 54 54 55 55 56 $quickstart= new ChmQuickstartBuilder($base,$output_dir );56 $quickstart= new ChmQuickstartBuilder($base,$output_dir.'/quickstart'); 57 57 $quickstart->buildDoc($pages); 58 58 -
trunk/buildscripts/chmbuilder/chm_style.css
r1464 r1902 628 628 color: red; 629 629 } 630 631 div.last-modified 632 { 633 font-size: 0.8em; 634 color: #999; 635 margin-top: 5em; 636 margin-bottom: -3em; 637 } 638 639 p.since-version, p.requires-version 640 { 641 display: none; 642 } 643 644 div.languages 645 { 646 display: none; 647 } -
trunk/buildscripts/texbuilder/Page2Tex.php
r1653 r1902 175 175 //text modifiers 176 176 $html = preg_replace('/<(b|strong)[^>]*>([^<]*)<\/(b|strong)>/', '\textbf{$2}', $html); 177 $html = preg_replace('/<i [^>]*>([^<]*)+?<\/i>/', '\emph{$1}', $html);177 $html = preg_replace('/<i [^>]*>([^<]*)+?<\/i>/', '\emph{$1}', $html); 178 178 $html = preg_replace_callback('/<tt>([^<]*)<\/tt>/', array($this,'texttt'), $html); 179 179 … … 214 214 $html = preg_replace('/<div class="last-modified">((.|\n)*?)<\/div>/', '', $html); 215 215 216 //since 217 $html = preg_replace('/<com:SinceVersion[^>]+>/', '', $html); 216 218 217 219 $html = html_entity_decode($html); -
trunk/buildscripts/texbuilder/quickstart/build.php
r1618 r1902 43 43 $content .= $parser->get_section_label($section); 44 44 $file_content = file_get_contents($page); 45 $tex =45 //$tex = 46 46 $content .= $parser->parse_html($page,$file_content); 47 47 } -
trunk/demos/quickstart/protected/pages/Advanced/Performance.page
r1695 r1902 34 34 </p> 35 35 36 <p >36 <p id="840059" class="block-content"> 37 37 Since v3.1.0, a new control called <a href="?page=Controls.OutputCache">TOutputCache</a> has been introduced. This control allows users to selectively cache parts of a page's output. When used appropriately, this technique can significant improve pages' performance because the underlying controls are not created at all if the cached versions are hit. 38 38 </p> -
trunk/demos/quickstart/protected/pages/Advanced/Scripts3.page
r1846 r1902 2 2 <h1 id="6801">Javascript in PRADO, Questions and Answers</h1> 3 3 <h2 id="6802">How do I include the Javascript libraries distributed with Prado?</h2> 4 <p >The javascript libraries distributed with Prado can be found in the4 <p id="880060" class="block-content">The javascript libraries distributed with Prado can be found in the 5 5 <tt>framework/Web/Javascripts/source</tt> directory. The <tt>packages.php</tt> 6 6 file in that directory defines a list of available package names available … … 37 37 your custom Javascript code to the page.</p> 38 38 39 <h2 >Publishing Javascript Libraries as Assets</h2>39 <h2 id="176028">Publishing Javascript Libraries as Assets</h2> 40 40 <com:SinceVersion Version="3.1b" /> 41 41 <p class="block-content">Use <a href="?page=Controls.ClientScriptLoader">TClientScriptLoader</a> to publish and combine multiple existing javascript files (e.g. javascript libraries distributed with Prado or otherwise) -
trunk/demos/quickstart/protected/pages/Configurations/Templates1.page
r1865 r1902 42 42 </prop:PropertyName> 43 43 </com:TTextHighlighter> 44 <p >44 <p id="200007" class="block-content"> 45 45 Since version 3.1.0, the property initialization tag can also be used to initialize a set of subproperties who share the same parent property. For example, the following is equivalent to <tt>HeaderStyle.BackColor="black"</tt> and <tt>HeaderStyle.ForeColor="red"</tt>. 46 46 </p> -
trunk/demos/quickstart/protected/pages/Controls/Validation.page
r1866 r1902 32 32 </ul> 33 33 34 <h1 >Prado Validation Controls</h1>34 <h1 id="116008">Prado Validation Controls</h1> 35 35 <a name="TRequiredFieldValidator"></a> 36 36 <h2 id="4902">TRequiredFieldValidator</h2> … … 161 161 162 162 <h1 id="123123">Interacting the Validators</h1> 163 <h2 >Resetting or Clearing of Validators</h2>163 <h2 id="116009">Resetting or Clearing of Validators</h2> 164 164 <p id="1212323"> 165 165 Validators can be reset on the client-side using javascript by calling the -
trunk/demos/quickstart/protected/pages/Database/ActiveRecord.page
r1899 r1902 4 4 <com:SinceVersion Version="3.1a" /> 5 5 <p id="690478" class="block-content">Active Records are objects that wrap a row in a database table or view, 6 encapsulate s the database access and addsdomain logic on that data.7 The basics of an Active Record is a business object class, e.g., a6 encapsulate the database access and add domain logic on that data. 7 The basics of an Active Record are business classes, e.g., a 8 8 <tt>Products</tt> class, that match very closely the record structure 9 9 of an underlying database table. Each Active Record will be responsible for 10 10 saving and loading data to and from the database. </p> 11 11 <div class="info"><b class="note">Info:</b> 12 The data structure of an Active Record should match exactlythat of a table12 The data structure of an Active Record should match that of a table 13 13 in the database. 14 Each field in the class must correspond to one column in the table. 14 Each column of a table should have a corresponding member variable or property in the 15 Active Record class the represents the table. 15 16 </div> 16 17 … … 33 34 Prado provides a complimentary choice between Active Record and 34 35 <a href="?page=Database.SqlMap">SqlMap Data Mapper</a>. 35 A SqlMap Data Mapper can be used to load Active Record objects, in turn ,these36 A SqlMap Data Mapper can be used to load Active Record objects, in turn; these 36 37 Active Record objects can be used to update the database. 37 38 The "relationship" between Active Records and <a href="?page=Database.SqlMap">SqlMap</a> is illustrated in the … … 42 43 43 44 <p id="690482" class="block-content"> 44 The Active Record class has methods that do the following:45 The Active Record class has functionality to perform the following tasks. 45 46 </p> 46 47 <ul id="u1" class="block-content"> 47 <li>Construct an instance of the Active Record from a SQL result set row.</li> 48 <li>Construct a new instance for later insertion into the table.</li> 48 <li>Create, Retrieve, Update and Delete records.</li> 49 49 <li>Finder methods to wrap commonly used SQL queries and return Active Record objects.</li> 50 <li>Update existing records and insert new records into the database.</li> 50 <li>Fetch relationships (related foreign objects) such as "has many", "has one", "belongs to" and "has many" via association table.</li> 51 <li>Lazy loading of relationships.</li> 51 52 </ul> 52 <h2 >Database Supported</h2>53 <h2 id="142010">Database Supported</h2> 53 54 <p id="p1" class="block-content"> 54 55 The Active Record implementation utilizes the <a href="?page=Database.DAO">Prado DAO</a> classes for data access. … … 61 62 <li><a href="#">MS SQL 2000 or later</a></li> 62 63 </ul> 63 <p >Support for other databases can be provided when there are sufficient demand.</p>64 <p id="710009" class="block-content">Support for other databases can be provided when there are sufficient demands.</p> 64 65 65 66 <h1 id="138048">Defining an Active Record</h1> 66 67 <p id="690483" class="block-content">Let us 67 consider the following " users" table that contains two columns named "username" and "email",68 where " username" is also the primary key.68 consider the following "<tt>users</tt>" table that contains two columns named "<tt>username</tt>" and "<tt>email</tt>", 69 where "<tt>username</tt>" is also the primary key. 69 70 <com:TTextHighlighter Language="sql" CssClass="source block-content" id="code_690147"> 70 71 CREATE TABLE users … … 76 77 </com:TTextHighlighter> 77 78 </p> 78 <p id="690484" class="block-content">Next we define our Active Record class that corresponds to the " users" table.79 <p id="690484" class="block-content">Next we define our Active Record class that corresponds to the "<tt>users</tt>" table. 79 80 <com:TTextHighlighter Language="php" CssClass="source block-content" id="code_690148"> 80 81 class UserRecord extends TActiveRecord … … 95 96 </com:TTextHighlighter> 96 97 </p> 97 <p id="690485" class="block-content">Each property of the <tt>UserRecord</tt> class must correspond to a 98 column with the same name in the "users" table. The class constant 98 <p id="690485" class="block-content">Each column of the "<tt>users</tt>" table must have corresponding 99 property of the same name as the column name in the <tt>UserRecord</tt> class. 100 Of course, you also define additional member variables or properties that does not exist in the table structure. 101 The class constant 99 102 <tt>TABLE</tt> is optional when the class name is the same as 100 103 the table name in the database, otherwise <tt>TABLE</tt> must … … 124 127 } 125 128 </com:TTextHighlighter> 129 <p id="710010" class="block-content">More details regarding TComponent can be found in the <a href="?page=Fundamentals.Components">Components documentation</a>. 130 Later we shall use the getter/setters to allow for lazy loading of relationship objects. 131 </p> 126 132 127 133 <div class="info"><b class="note">Info:</b> … … 135 141 The static method <tt>finder()</tt> returns an <tt>UserRecord</tt> instance 136 142 that can be used to load records from the database. The loading of records 137 using the finer methods is discuss a little later. The <tt>TActiveRecord::finder()</tt>138 static method takes the name of the currentActive Record class as parameter.143 using the finer methods is discussed a little later. The <tt>TActiveRecord::finder()</tt> 144 static method takes the name of an Active Record class as parameter. 139 145 </p> 140 146 … … 143 149 A default database connection for Active Record can be set as follows. 144 150 See <a href="?page=Database.DAO">Establishing Database Connection</a> for 145 futher details regarding creation of database connection in general. 151 further details regarding creation of database connection in general. 152 </p> 146 153 <com:TTextHighlighter Language="php" CssClass="source block-content" id="code_690150"> 147 154 //create a connection and give it to the Active Record manager. … … 150 157 TActiveRecordManager::getInstance()->setDbConnection($conn); 151 158 </com:TTextHighlighter> 152 </p> 153 159 160 <p id="710011" class="block-content">Alternatively, you can create a base class and override the <tt>getDbConnection()</tt> 161 method to return a database connection. This is a simple way to permit multiple 162 connections and multiple databases. The following code demonstrates defining 163 the database connection in a base class (not need to set the DB connection anywhere else). 164 </p> 165 <com:TTextHighlighter Language="php" CssClass="source block-content"> 166 class MyDb1Record extends TActiveRecord 167 { 168 public function getDbConnection() 169 { 170 static $conn; 171 if($conn===null) 172 $conn = new TDbConnection('xxx','yyy','zzz'); 173 return $conn; 174 } 175 } 176 class MyDb2Record extends TActiveRecord 177 { 178 public function getDbConnection() 179 { 180 static $conn; 181 if($conn===null) 182 $conn = new TDbConnection('aaa','bbb','ccc'); 183 return $conn; 184 } 185 } 186 </com:TTextHighlighter> 187 188 189 <h3 class="prado-specific">Using <tt>application.xml</tt> within the Prado Framework</h3> 190 <div class="prado-specific"> 154 191 <p id="690488" class="block-content"> 155 192 The default database connection can also be configured using a <tt><module></tt> … … 168 205 meta data, that is, the table columns names, indexes and constraints are 169 206 saved in the cache and reused. You must clear or disable the cache if you 170 wish to see chan ages made to your table definitions. A <a href="?page=Advanced.Performance#6402">cache207 wish to see changes made to your table definitions. A <a href="?page=Advanced.Performance#6402">cache 171 208 module</a> must also be defined for the cache to function. 172 209 </div> … … 191 228 </com:TTextHighlighter> 192 229 </p> 230 </div> 193 231 194 232 <h2 id="138050">Loading data from the database</h2> 195 233 <p id="690490" class="block-content"> 196 234 The <tt>TActiveRecord</tt> class provides many convenient methods to find 197 records from the database. The simplest is finding records by matching primary keys. 235 records from the database. The simplest is finding one record by matching a primary key or a 236 composite key (primary keys that consists of multiple columns). 198 237 See the <com:DocLink ClassPath="System.Data.ActiveRecord.TActiveRecord" /> for 199 238 more details. 200 239 </p> 201 <h3 id="138055"><tt>findByPk()</tt></h3> 202 <p id="690491" class="block-content">Finds one record using only the primary key or composite primary keys. 240 241 <div class="info"><b class="note">Info:</b> 242 All finder methods that may return 1 record only will return <tt>null</tt> if no matching data 243 is found. All finder methods that return an array of records will return an empty array if no 244 matching data is found. 245 </div> 246 247 <h3 id="138055"><tt>findByPk()</tt></h3> 248 <p id="690491" class="block-content">Finds one record using only a primary key or a composite key. 203 249 <com:TTextHighlighter Language="php" CssClass="source block-content" id="code_690153"> 204 250 $finder = UserRecord::finder(); 205 251 $user = $finder->findByPk($primaryKey); 206 252 207 //when the table uses composite keys253 //when the table uses a composite key 208 254 $record = $finder->findByPk($key1, $key2, ...); 209 255 $record = $finder->findByPk(array($key1, $key2,...)); … … 212 258 213 259 <h3 id="138056"><tt>findAllByPks()</tt></h3> 214 <p id="690492" class="block-content">Finds multiple records using a list of primary keys or composite primary keys. 215 The following are equivalent for scalar primary keys (primary key consisting of only one column/field). 260 <p id="690492" class="block-content">Finds multiple records using a list of primary keys or composite keys. 261 The following are equivalent for primary keys (primary key consisting of only one column/field). 262 </p> 216 263 <com:TTextHighlighter Language="php" CssClass="source block-content" id="code_690154"> 217 264 $finder = UserRecord::finder(); 218 $users = $finder->findAllByPk ($key1, $key2, ...);219 $users = $finder->findAllByPk (array($key1, $key2, ...));265 $users = $finder->findAllByPks($key1, $key2, ...); 266 $users = $finder->findAllByPks(array($key1, $key2, ...)); 220 267 </com:TTextHighlighter> 221 268 The following are equivalent for composite keys. … … 226 273 $keys = array( array($key1, $key2), array($key3, $key4), ... ); 227 274 $record = $finder->findAllByPks($keys); 228 229 </com:TTextHighlighter> 230 </p> 275 </com:TTextHighlighter> 231 276 232 277 … … 271 316 </com:TTextHighlighter> 272 317 318 <div class="note"><b class="note">Note:</b> 319 For MSSQL and when <tt>Limit</tt> and <tt>Offset</tt> are positive integer values. The 320 actual query to be executed is modified by the 321 <com:DocLink ClassPath="System.Data.ActiveRecord.Common.Mssql.TMssqlCommandBuilder" 322 Text="TMssqlCommandBuilder" 323 /> 324 class according to 325 <a href="http://troels.arvin.dk/db/rdbms/#select-limit-offset">http://troels.arvin.dk/db/rdbms/</a> 326 to emulate the <tt>Limit</tt> and <tt>Offset</tt> conditions. 327 </div> 328 273 329 <h3 id="138058"><tt>findAll()</tt></h3> 274 330 <p id="690495" class="block-content">Same as <tt>find()</tt> but returns an array of objects.</p> 275 331 276 332 <h3 id="138059"><tt>findBy*()</tt> and <tt>findAllBy*()</tt></h3> 277 <p id="690496" class="block-content">Dynamic find method using parts of method name as search criteria.278 Method names starting with <tt>findBy</tt> return 1 record only .279 Method names starting with <tt>findAllBy</tt> return an array of records.333 <p id="690496" class="block-content">Dynamic find method using parts of the method name as search criteria. 334 Method names starting with <tt>findBy</tt> return 1 record only 335 and method names starting with <tt>findAllBy</tt> return an array of records. 280 336 The condition is taken as part of the method name after <tt>findBy</tt> or <tt>findAllBy</tt>. 281 337 … … 299 355 300 356 <div class="tip"><b class="note">Tip:</b> 301 You may also use <tt>OR</tt> as a condition in the dynamic methods.357 You may also use a combination of <tt>AND</tt> and <tt>OR</tt> as a condition in the dynamic methods. 302 358 </div> 303 359 304 <h3 id="138060"><tt>findBySql()</tt></h3> 305 <p id="690497" class="block-content">Finds records using full SQL, returns corresponding array of record objects.</p> 306 360 <h3 id="138060"><tt>findBySql()</tt> and <tt>findAllBySql()</tt></h3> 361 <p id="690497" class="block-content">Finds records using full SQL where <tt>findBySql()</tt> 362 return an Active Record and <tt>findAllBySql()</tt>returns an array of record objects. 363 For each column returned, the corresponding Active Record class must define a member variable or 364 property for each corresponding column name. 365 <com:TTextHighlighter Language="php" CssClass="source block-content"> 366 class UserRecord2 extends UserRecord 367 { 368 public $another_value; 369 } 370 $sql = "SELECT users.*, 'hello' as another_value FROM users"; 371 $users = TActiveRecord::finder('UserRecord2')->findAllBySql($sql); 372 </com:TTextHighlighter> 373 </p> 307 374 <h3 id="138061"><tt>count()</tt></h3> 308 <p id="690498" class="block-content">Find the number of matchings records .</p>375 <p id="690498" class="block-content">Find the number of matchings records, accepts same parameters as the <tt>findAll()</tt> method.</p> 309 376 310 377 <h2 id="138051">Inserting and updating records</h2> … … 328 395 For example, if you insert a new record into a MySQL table that has columns 329 396 defined with "autoincrement", the Active Record objects will be updated with the new 330 incremented value s.</div>397 incremented value.</div> 331 398 332 399 <p id="690500" class="block-content"> … … 342 409 </p> 343 410 344 <p >411 <p id="710012" class="block-content"> 345 412 Active Record objects have a simple life-cycle illustrated in the following diagram.
