From 604be351b5eba72087410fd0ed8f49a3be307bb3 Mon Sep 17 00:00:00 2001
From: wei <>
Date: Fri, 9 Nov 2007 01:48:38 +0000
Subject: update prado-dao build.
---
build.xml | 58 +++++++++++++-----------
demos/northwind-db/protected/database/Region.php | 3 +-
2 files changed, 34 insertions(+), 27 deletions(-)
diff --git a/build.xml b/build.xml
index 0b2bf52d..e159f68b 100644
--- a/build.xml
+++ b/build.xml
@@ -152,13 +152,13 @@
-
-
+
+
-
-
+
+
@@ -169,7 +169,7 @@
-
+
-
+
-
+
-
+
-
+
@@ -210,26 +210,26 @@
-
+
-
+
+ files="TActiveRecord.php,TActiveRecordManager.php,Exceptions/TActiveRecordException.php,TActiveRecordCriteria.php,TActiveRecordGateway.php" />
+ destfile="${build.compact.dir}/prado-dao/messages.txt" />
-
+
@@ -239,7 +239,7 @@
files="IMappedStatement.php,TMappedStatement.php,TCachingStatement.php,TUpdateMappedStatement.php,TDeleteMappedStatement.php,TInsertMappedStatement.php,TPreparedCommand.php,TPreparedStatement.php,TPreparedStatementFactory.php,TSelectMappedStatement.php,TSimpleDynamicSql.php,TStaticSql.php"/>
+ destfile="${build.compact.dir}/prado-dao/messages.txt" />
@@ -253,12 +253,12 @@
setDbConnection($conn);
-$manager = new TSqlMapManager($conn);
-$manager->configureXml('./database/sqlmap.xml');
-$sqlmap = $manager->getSqlMapGateway();
-
//start playing
foreach(Employee::finder()->findAll() as $employee)
var_dump($employee->LastName);
+//fetch all regions and its territories.
foreach(Region::finder()->withTerritories()->findAll() as $region)
{
var_dump($region->RegionDescription);
@@ -294,11 +292,19 @@ foreach(Region::finder()->withTerritories()->findAll() as $region)
var_dump($territory->TerritoryDescription);
}
+//sqlmap example
+$manager = new TSqlMapManager($conn);
+$manager->configureXml('./database/sqlmap.xml');
+$sqlmap = $manager->getSqlMapGateway();
+
var_dump($sqlmap->queryForList('products-with-price', 50));
+//similar query, but not identical
+//Product::finder()->withCategory()->findAll('UnitPrice < ?', 50)
+
?>]]>
-
+
diff --git a/demos/northwind-db/protected/database/Region.php b/demos/northwind-db/protected/database/Region.php
index c6e23485..3d1c2a84 100644
--- a/demos/northwind-db/protected/database/Region.php
+++ b/demos/northwind-db/protected/database/Region.php
@@ -9,7 +9,8 @@ class Region extends TActiveRecord
public $RegionID;
public $RegionDescription;
- public $Territories=array();
+ //comment out the following line to use lazy loading
+ //public $Territories=array();
public static $RELATIONS = array
(
--
cgit v1.2.3