Packages:
default
System
System.Caching
System.Collections
System.Data
System.Data.ActiveRecord
System.Data.ActiveRecord.Relations
System.Data.ActiveRecord.Scaffold
System.Data.ActiveReecord.Scaffold.InputBuilder
System.Data.Commom.Sqlite
System.Data.Common
System.Data.Common.Mssql
System.Data.Common.Mysql
System.Data.Common.Oracle
System.Data.Common.Pgsql
System.Data.Common.Sqlite
System.Data.DataGateway
System.Data.SqlMap
System.Data.SqlMap.Configuration
System.Data.SqlMap.Statements
System.Exceptions
System.I18N
System.IO
System.Security
System.Util
System.Web
System.Web.Services
System.Web.UI
System.Web.UI.ActiveControls
System.Web.UI.WebControls
System.Web.UI.WebControls.assets
System.Xml


Classes:
Keyword

Class TActiveRecordConfig

TComponent
   |
   --TApplicationComponent
      |
      --TModule
         |
         --TDataSourceConfig
            |
            --TActiveRecordConfig

TActiveRecordConfig module configuration class.

Database configuration for the default ActiveRecord manager instance.

Example: application.xml configuration

  1. <modules>
  2. <module class="System.Data.ActiveRecord.TActiveRecordConfig" EnableCache="true">
  3. <database ConnectionString="mysql:host=localhost;dbname=test"
  4. Username="dbuser" Password="dbpass" />
  5. </module>
  6. </modules>

MySQL database definition:

  1. CREATE TABLE `blogs` (
  2. `blog_id` int(10) unsigned NOT NULL auto_increment,
  3. `blog_name` varchar(255) NOT NULL,
  4. `blog_author` varchar(255) NOT NULL,
  5. PRIMARY KEY (`blog_id`)
  6. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Record php class:

  1. class Blogs extends TActiveRecord
  2. {
  3. public $blog_id;
  4. public $blog_name;
  5. public $blog_author;
  6.  
  7. public static function finder($className=__CLASS__)
  8. {
  9. return parent::finder($className);
  10. }
  11. }

Usage example:

  1. class Home extends TPage
  2. {
  3. function onLoad($param)
  4. {
  5. $blogs = Blogs::finder()->findAll();
  6. print_r($blogs);
  7. }
  8. }

Since: 3.1
Author: Wei Zhuo <weizho[at]gmail[dot]com>

Method Summary
boolean
TActiveRecordInvalidFinderResult
void
init ( TXmlDocument $xml)
Initialize the active record manager.
void
setEnableCache ( boolean $value)
Set true to cache the table meta data.
void
Define the way an active record finder react if an invalid magic-finder invoked
Methods Inherited From TDataSourceConfig
TDataSourceConfig::findConnectionByID(), TDataSourceConfig::getConnectionClass(), TDataSourceConfig::getConnectionID(), TDataSourceConfig::getDatabase(), TDataSourceConfig::getDbConnection(), TDataSourceConfig::init(), TDataSourceConfig::setConnectionClass(), TDataSourceConfig::setConnectionID()
Methods Inherited From TModule
TModule::getID(), TModule::init(), TModule::setID()
Methods Inherited From TApplicationComponent
TApplicationComponent::getApplication(), TApplicationComponent::getRequest(), TApplicationComponent::getResponse(), TApplicationComponent::getService(), TApplicationComponent::getSession(), TApplicationComponent::getUser(), TApplicationComponent::publishAsset(), TApplicationComponent::publishFilePath()
Methods Inherited From TComponent
TComponent::addParsedObject(), TComponent::attachEventHandler(), TComponent::canGetProperty(), TComponent::canSetProperty(), TComponent::createdOnTemplate(), TComponent::detachEventHandler(), TComponent::evaluateExpression(), TComponent::evaluateStatements(), TComponent::getEventHandlers(), TComponent::getSubProperty(), TComponent::hasEvent(), TComponent::hasEventHandler(), TComponent::hasProperty(), TComponent::raiseEvent(), TComponent::setSubProperty(), TComponent::__get(), TComponent::__set()

Method Details

getEnableCache

public boolean getEnableCache ()

Output
boolean true if table meta data should be cached, false otherwise.
Exception

getInvalidFinderResult

public TActiveRecordInvalidFinderResult getInvalidFinderResult ()

Output
TActiveRecordInvalidFinderResult Defaults to 'Null'.
Exception

init

public void init (TXmlDocument $xml )

Initialize the active record manager.

Input
TXmlDocument$xmlxml configuration.
Output
Exception

setEnableCache

public void setEnableCache (boolean $value )

Set true to cache the table meta data.

Input
boolean$valuetrue to cache sqlmap instance.
Output
Exception

setInvalidFinderResult

public void setInvalidFinderResult (TActiveRecordInvalidFinderResult $value )

Define the way an active record finder react if an invalid magic-finder invoked

Input
TActiveRecordInvalidFinderResult$value
Output
Exception