Class \Prado\Data\ActiveRecord\TActiveRecordConfig
TActiveRecordConfig module configuration class.
Database configuration for the default ActiveRecord manager instance.
Example: application.xml configuration
<modules>
<module class="Prado\Data\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);
}
}
Class hierarchy
- \Prado\Data\ActiveRecord\TActiveRecordConfig
- \Prado\Data\TDataSourceConfig
- \Prado\TModule implements IModule
- \Prado\TApplicationComponent
- \Prado\TComponent
Since: 3.1
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
setInvalidFinderResult(TActiveRecordInvalidFinderResult $value) : mixed
Define the way an active record finder react if an invalid magic-finder invoked
|
public
|
public
mixed
|
DEFAULT_GATEWAY_CLASS
|
\Prado\Data\ActiveRecord\TActiveRecordGateway::class
|
public
mixed
|
DEFAULT_MANAGER_CLASS
|
\Prado\Data\ActiveRecord\TActiveRecordManager::class
|
\Prado\TApplicationComponent::FX_CACHE_FILE, \Prado\TComponent::GLOBAL_RAISE_EVENT_LISTENER |