Class TActiveRecordConfig
TActiveRecordConfig module configuration class.
Database configuration for the default ActiveRecord manager instance. Example: application.xml configuration - <modules>
- <module class="System.Data.ActiveRecord.TActiveRecordConfig" EnableCache="true">
- <database ConnectionString="mysql:host=localhost;dbname=test"
- Username="dbuser" Password="dbpass" />
- </module>
- </modules>
MySQL database definition: - CREATE TABLE `blogs` (
- `blog_id` int(10) unsigned NOT NULL auto_increment,
- `blog_name` varchar(255) NOT NULL,
- `blog_author` varchar(255) NOT NULL,
- PRIMARY KEY (`blog_id`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Record php class: - class Blogs extends TActiveRecord
- {
- public $blog_id;
- public $blog_name;
- public $blog_author;
-
- public static function finder($className=__CLASS__)
- {
- return parent::finder($className);
- }
- }
Usage example: - class Home extends TPage
- {
- function onLoad($param)
- {
- $blogs = Blogs::finder()->findAll();
- print_r($blogs);
- }
- }
Method Summary |
boolean
|
|
TActiveRecordInvalidFinderResult
|
|
void
|
Initialize the active record manager.
|
void
|
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 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
|
init
Initialize the active record manager.
|
setEnableCache
public void setEnableCache |
(boolean $value ) |
Set true to cache the table meta data.
Input |
boolean | $value | true to cache sqlmap instance. |
Output |
Exception |
|
setInvalidFinderResult
Define the way an active record finder react if an invalid magic-finder invoked
|
|