Changeset 2333
- Timestamp:
- 11/08/2007 07:48:38 PM (13 months ago)
- Location:
- trunk
- Files:
-
- 2 modified
-
build.xml (modified) (14 diffs)
-
demos/northwind-db/protected/database/Region.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/build.xml
r2044 r2333 153 153 <mkdir dir="${build.compact.dir}" /> 154 154 <mkdir dir="${build.compact.dir}/docs" /> 155 <mkdir dir="${build.compact.dir}/prado-d b" />156 <compact-package output="${build.compact.dir}/prado-d b/collections.php" strip="${compact-strip-comments}">155 <mkdir dir="${build.compact.dir}/prado-dao" /> 156 <compact-package output="${build.compact.dir}/prado-dao/collections.php" strip="${compact-strip-comments}"> 157 157 <filelist dir="framework" files="PradoBase.php,TComponent.php,Exceptions/TException.php,interfaces.php" /> 158 158 <filelist dir="framework/Collections" files="TList.php,TMap.php,TAttributeCollection.php,TPagedList.php,TPagedDataSource.php" /> 159 159 </compact-package> 160 <delete file="${build.compact.dir}/prado-d b/messages.txt" />161 <copy file="framework/Exceptions/messages .txt" tofile="${build.compact.dir}/prado-db/messages.txt" />160 <delete file="${build.compact.dir}/prado-dao/messages.txt" /> 161 <copy file="framework/Exceptions/messages/messages.txt" tofile="${build.compact.dir}/prado-dao/messages.txt" /> 162 162 <copy file="COPYRIGHT" tofile="${build.compact.dir}/COPYRIGHT" /> 163 163 <copy file="HISTORY" tofile="${build.compact.dir}/HISTORY" /> … … 170 170 171 171 <target name="compact-db" description="Database" depends="compact-collections"> 172 <compact-package output="${build.compact.dir}/prado-d b/db.php" strip="${compact-strip-comments}">172 <compact-package output="${build.compact.dir}/prado-dao/db.php" strip="${compact-strip-comments}"> 173 173 <filelist dir="framework/Data" 174 174 files="TDbConnection.php, TDbCommand.php, TDbDataReader.php, TDbTransaction.php"/> … … 180 180 181 181 <target name="compact-db-sqlite" description="Sqlite Database" depends="compact-db"> 182 <compact-package output="${build.compact.dir}/prado-d b/db-sqlite.php" strip="${compact-strip-comments}">182 <compact-package output="${build.compact.dir}/prado-dao/db-sqlite.php" strip="${compact-strip-comments}"> 183 183 <filelist dir="framework/Data/Common/Sqlite" 184 184 files="TSqliteCommandBuilder.php,TSqliteMetaData.php,TSqliteTableColumn.php,TSqliteTableInfo.php" /> … … 187 187 188 188 <target name="compact-db-mysql" description="Mysql Database" depends="compact-db"> 189 <compact-package output="${build.compact.dir}/prado-d b/db-mysql.php" strip="${compact-strip-comments}">189 <compact-package output="${build.compact.dir}/prado-dao/db-mysql.php" strip="${compact-strip-comments}"> 190 190 <filelist dir="framework/Data/Common/Mysql" 191 191 files="TMysqlCommandBuilder.php,TMysqlMetaData.php,TMysqlTableColumn.php,TMysqlTableInfo.php" /> … … 194 194 195 195 <target name="compact-db-pgsql" description="Pgsql Database" depends="compact-db"> 196 <compact-package output="${build.compact.dir}/prado-d b/db-pgsql.php" strip="${compact-strip-comments}">196 <compact-package output="${build.compact.dir}/prado-dao/db-pgsql.php" strip="${compact-strip-comments}"> 197 197 <filelist dir="framework/Data/Common/Pgsql" 198 198 files="TPgsqlCommandBuilder.php,TPgsqlMetaData.php,TPgsqlTableColumn.php,TPgsqlTableInfo.php" /> … … 201 201 202 202 <target name="compact-db-mssql" description="Mssql Database" depends="compact-db"> 203 <compact-package output="${build.compact.dir}/prado-d b/db-mssql.php" strip="${compact-strip-comments}">203 <compact-package output="${build.compact.dir}/prado-dao/db-mssql.php" strip="${compact-strip-comments}"> 204 204 <filelist dir="framework/Data/Common/Mssql" 205 205 files="TMssqlCommandBuilder.php,TMssqlMetaData.php,TMssqlTableColumn.php,TMssqlTableInfo.php" /> … … 211 211 212 212 <target name="compact-table-gateway" description="Package Active Record" depends="compact-db-all"> 213 <compact-package output="${build.compact.dir}/prado-d b/table-gateway.php" strip="${compact-strip-comments}">213 <compact-package output="${build.compact.dir}/prado-dao/table-gateway.php" strip="${compact-strip-comments}"> 214 214 <filelist dir="framework/Data/DataGateway" 215 215 files="TDataGatewayCommand.php, TSqlCriteria.php, TTableGateway.php"/> … … 218 218 219 219 <target name="compact-active-record" description="Package Active Record" depends="compact-table-gateway"> 220 <compact-package output="${build.compact.dir}/prado-d b/active-record.php" strip="${compact-strip-comments}">220 <compact-package output="${build.compact.dir}/prado-dao/active-record.php" strip="${compact-strip-comments}"> 221 221 <filelist dir="framework/Data/ActiveRecord" 222 files="TActiveRecord.php,TActiveRecordManager.php,Exceptions/TActiveRecordException.php,TActiveRecordCriteria.php,TActiveRecordGateway.php ,TActiveRecordStateRegistry.php" />222 files="TActiveRecord.php,TActiveRecordManager.php,Exceptions/TActiveRecordException.php,TActiveRecordCriteria.php,TActiveRecordGateway.php" /> 223 223 <filelist dir="framework/Data/ActiveRecord/Relations" 224 224 files="TActiveRecordRelation.php,TActiveRecordRelationContext.php,TActiveRecordHasOne.php,TActiveRecordHasManyAssociation.php,TActiveRecordHasMany.php,TActiveRecordBelongsTo.php" /> 225 225 </compact-package> 226 226 <append file="framework/Data/ActiveRecord/Exceptions/messages.txt" 227 destfile="${build.compact.dir}/prado-d b/messages.txt" />227 destfile="${build.compact.dir}/prado-dao/messages.txt" /> 228 228 <prado-quickstart-docs output="${build.compact.dir}/docs" pages="Database/ActiveRecord.page" /> 229 229 </target> 230 230 231 231 <target name="compact-sqlmap" description="Package SqlMap" depends="compact-db-all"> 232 <compact-package output="${build.compact.dir}/prado-d b/sqlmap.php" strip="${compact-strip-comments}">232 <compact-package output="${build.compact.dir}/prado-dao/sqlmap.php" strip="${compact-strip-comments}"> 233 233 <filelist dir="framework/Data/SqlMap" files="TSqlMapManager.php,TSqlMapGateway.php" /> 234 234 <filelist dir="framework/Data/SqlMap/DataMapper" … … 240 240 </compact-package> 241 241 <append file="framework/Data/SqlMap/DataMapper/messages.txt" 242 destfile="${build.compact.dir}/prado-d b/messages.txt" />242 destfile="${build.compact.dir}/prado-dao/messages.txt" /> 243 243 <prado-quickstart-docs output="${build.compact.dir}/docs" pages="Database/SqlMap.page" /> 244 244 </target> … … 254 254 <append destfile="${build.compact.dir}/examples/example.php"><![CDATA[<?php 255 255 256 include('../prado-d b/collections.php');257 include('../prado-d b/db.php');258 include('../prado-d b/db-sqlite.php');259 include('../prado-d b/table-gateway.php');260 include('../prado-d b/active-record.php');261 include('../prado-d b/sqlmap.php');256 include('../prado-dao/collections.php'); 257 include('../prado-dao/db.php'); 258 include('../prado-dao/db-sqlite.php'); 259 include('../prado-dao/table-gateway.php'); 260 include('../prado-dao/active-record.php'); 261 include('../prado-dao/sqlmap.php'); 262 262 263 263 $sqlite_dir = './data'; … … 274 274 set_include_path(get_include_path().PATH_SEPARATOR.$class_dir); 275 275 spl_autoload_register(array('PradoBase', 'autoload')); 276 //other forms of auto load may be used. 276 277 277 278 $conn = new TDbConnection("sqlite:$sqlite_db"); … … 279 280 TActiveRecordManager::getInstance()->setDbConnection($conn); 280 281 281 $manager = new TSqlMapManager($conn);282 $manager->configureXml('./database/sqlmap.xml');283 $sqlmap = $manager->getSqlMapGateway();284 285 282 //start playing 286 283 … … 288 285 var_dump($employee->LastName); 289 286 287 //fetch all regions and its territories. 290 288 foreach(Region::finder()->withTerritories()->findAll() as $region) 291 289 { … … 295 293 } 296 294 295 //sqlmap example 296 $manager = new TSqlMapManager($conn); 297 $manager->configureXml('./database/sqlmap.xml'); 298 $sqlmap = $manager->getSqlMapGateway(); 299 297 300 var_dump($sqlmap->queryForList('products-with-price', 50)); 298 301 302 //similar query, but not identical 303 //Product::finder()->withCategory()->findAll('UnitPrice < ?', 50) 304 299 305 ?>]]></append> 300 306 </target> 301 <target name="compact- all" description="All packages" depends="compact-active-record,compact-sqlmap" />307 <target name="compact-dao" description="All packages" depends="compact-active-record,compact-sqlmap,compact-northwind" /> 302 308 303 309 <!-- end compact packaging --> -
trunk/demos/northwind-db/protected/database/Region.php
r2274 r2333 10 10 public $RegionDescription; 11 11 12 public $Territories=array(); 12 //comment out the following line to use lazy loading 13 //public $Territories=array(); 13 14 14 15 public static $RELATIONS = array
