summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/pages/Database/Samples
diff options
context:
space:
mode:
Diffstat (limited to 'demos/quickstart/protected/pages/Database/Samples')
-rw-r--r--demos/quickstart/protected/pages/Database/Samples/Scaffold/Home.page7
-rw-r--r--demos/quickstart/protected/pages/Database/Samples/Scaffold/Home.php33
-rw-r--r--demos/quickstart/protected/pages/Database/Samples/Scaffold/sqlite.dbbin0 -> 4096 bytes
-rw-r--r--demos/quickstart/protected/pages/Database/Samples/config.xml5
4 files changed, 45 insertions, 0 deletions
diff --git a/demos/quickstart/protected/pages/Database/Samples/Scaffold/Home.page b/demos/quickstart/protected/pages/Database/Samples/Scaffold/Home.page
new file mode 100644
index 00000000..21f508f7
--- /dev/null
+++ b/demos/quickstart/protected/pages/Database/Samples/Scaffold/Home.page
@@ -0,0 +1,7 @@
+<com:TContent ID="body" >
+
+<h1>Active Record Scaffold Example</h1>
+
+<com:TScaffoldView RecordClass="AddressRecord" />
+
+</com:TContent>
diff --git a/demos/quickstart/protected/pages/Database/Samples/Scaffold/Home.php b/demos/quickstart/protected/pages/Database/Samples/Scaffold/Home.php
new file mode 100644
index 00000000..9bfe3f6d
--- /dev/null
+++ b/demos/quickstart/protected/pages/Database/Samples/Scaffold/Home.php
@@ -0,0 +1,33 @@
+<?php
+
+Prado::using('System.Data.ActiveRecord.TActiveRecord');
+Prado::using('System.Data.ActiveRecord.Scaffold.TScaffoldView');
+
+class AddressRecord extends TActiveRecord
+{
+ public $id;
+ public $username;
+ public $phone;
+
+ public static $_tablename='addresses';
+
+ //for demo, we use static db here
+ //otherwise we should use TActiveRecordConfig in application.xml
+ private static $_db;
+ public function getDbConnection()
+ {
+ if(self::$_db===null)
+ {
+ $file = dirname(__FILE__).'/sqlite.db';
+ self::$_db = new TDbConnection("sqlite:{$file}");
+ }
+ return self::$_db;
+ }
+}
+
+class Home extends TPage
+{
+
+}
+
+?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Database/Samples/Scaffold/sqlite.db b/demos/quickstart/protected/pages/Database/Samples/Scaffold/sqlite.db
new file mode 100644
index 00000000..65d77a66
--- /dev/null
+++ b/demos/quickstart/protected/pages/Database/Samples/Scaffold/sqlite.db
Binary files differ
diff --git a/demos/quickstart/protected/pages/Database/Samples/config.xml b/demos/quickstart/protected/pages/Database/Samples/config.xml
new file mode 100644
index 00000000..51da9ed0
--- /dev/null
+++ b/demos/quickstart/protected/pages/Database/Samples/config.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<configuration>
+ <pages MasterClass="SampleLayout" />
+</configuration> \ No newline at end of file