blob: 9bfe3f6dd18da3d6b4d2375094809043d52b8878 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
{
}
?>
|