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);
}
}
Mostra file
Open project: pradosoft/prado
Method | Description | |
---|---|---|
getEnableCache ( ) : boolean | ||
getGatewayClass ( ) : string | ||
getInvalidFinderResult ( ) : |
||
getManager ( ) : |
||
getManagerClass ( ) : string | ||
init ( $xml ) | Initialize the active record manager. | |
setEnableCache ( $value ) | Set true to cache the table meta data. | |
setGatewayClass ( string $value ) | Set implementation class of ActiveRecordGateway | |
setInvalidFinderResult ( $value ) | Define the way an active record finder react if an invalid magic-finder invoked | |
setManagerClass ( string $value ) | Set implementation class of ActiveRecordManager |
public getEnableCache ( ) : boolean | ||
return | boolean | true if table meta data should be cached, false otherwise. |
public getGatewayClass ( ) : string | ||
return | string | the implementation class of ActiveRecordGateway. Defaults to {@link TActiveRecordConfig::DEFAULT_GATEWAY_CLASS DEFAULT_GATEWAY_CLASS} |
public getInvalidFinderResult ( ) : |
||
return | Defaults to '{@link TActiveRecordInvalidFinderResult::Null Null}'. |
public getManagerClass ( ) : string | ||
return | string | the implementation class of ActiveRecordManager. Defaults to {@link TActiveRecordConfig::DEFAULT_GATEWAY_CLASS DEFAULT_MANAGER_CLASS} |
public setEnableCache ( $value ) |
public setGatewayClass ( string $value ) | ||
$value | string |
public setInvalidFinderResult ( $value ) |
public setManagerClass ( string $value ) | ||
$value | string |