Class TActiveRecordConfig

Description

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(10unsigned NOT NULL auto_increment,
  3.   `blog_name` varchar(255NOT NULL,
  4.   `blog_author` varchar(255NOT 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.  }

  • author: Wei Zhuo <weizho[at]gmail[dot]com>
  • version: $Id: TActiveRecordConfig.php 3030 2011-08-28 05:51:36Z GODZilla0480@gmail.com $
  • since: 3.1

Located in /Data/ActiveRecord/TActiveRecordConfig.php (line 73)

TComponent
   |
   --TApplicationComponent
      |
      --TModule
         |
         --TDataSourceConfig
            |
            --TActiveRecordConfig
Class Constant Summary
 DEFAULT_GATEWAY_CLASS = 'System.Data.ActiveRecord.TActiveRecordGateway'
 DEFAULT_MANAGER_CLASS = 'System.Data.ActiveRecord.TActiveRecordManager'
Method Summary
Methods
getEnableCache (line 175)
  • return: true if table meta data should be cached, false otherwise.
  • access: public
boolean getEnableCache ()
getGatewayClass (line 158)
  • return: the implementation class of ActiveRecordGateway. Defaults to DEFAULT_GATEWAY_CLASS
  • access: public
string getGatewayClass ()
getInvalidFinderResult (line 185)
TActiveRecordInvalidFinderResult getInvalidFinderResult ()
getManager (line 123)
  • access: public
TActiveRecordManager getManager ()
getManagerClass (line 141)
  • return: the implementation class of ActiveRecordManager. Defaults to DEFAULT_MANAGER_CLASS
  • access: public
string getManagerClass ()
init (line 109)

Initialize the active record manager.

  • access: public
void init (TXmlDocument $xml)

Redefinition of:
TDataSourceConfig::init()
Initalize the database connection properties from attributes in <database> tag.
setEnableCache (line 167)

Set true to cache the table meta data.

  • access: public
void setEnableCache (boolean $value)
  • boolean $value: true to cache sqlmap instance.
setGatewayClass (line 150)

Set implementation class of ActiveRecordGateway

  • access: public
void setGatewayClass (string $value)
  • string $value
setInvalidFinderResult (line 197)

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

void setInvalidFinderResult (TActiveRecordInvalidFinderResult $value)
setManagerClass (line 133)

Set implementation class of ActiveRecordManager

  • access: public
void setManagerClass (string $value)
  • string $value

Inherited Methods

Inherited From TDataSourceConfig

TDataSourceConfig::findConnectionByID()
TDataSourceConfig::getConnectionClass()
TDataSourceConfig::getConnectionID()
TDataSourceConfig::getDatabase()
TDataSourceConfig::getDbConnection()
TDataSourceConfig::init()
TDataSourceConfig::setConnectionClass()
TDataSourceConfig::setConnectionID()

Inherited From TModule

TModule::getID()
TModule::init()
TModule::setID()

Inherited From TApplicationComponent

TApplicationComponent::getApplication()
TApplicationComponent::getRequest()
TApplicationComponent::getResponse()
TApplicationComponent::getService()
TApplicationComponent::getSession()
TApplicationComponent::getUser()
TApplicationComponent::publishAsset()
TApplicationComponent::publishFilePath()

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::__call()
TComponent::__get()
TComponent::__set()
TComponent::__sleep()
TComponent::__wakeup()
Class Constants
DEFAULT_GATEWAY_CLASS = 'System.Data.ActiveRecord.TActiveRecordGateway' (line 76)
DEFAULT_MANAGER_CLASS = 'System.Data.ActiveRecord.TActiveRecordManager' (line 75)

Documentation generated on Mon, 25 Jun 2012 14:37:12 +0200 by phpDocumentor 1.4.3