Support Joomla!

references:joomla.framework:application:jmodel-getdbo

Table of Contents

getDBO

API Package Subpackage Class Method Reference Last reviewed Doc status
API Home Package Joomla.Framework Subpackage Application Class JModel Method getDBO Reference getDBO() Never Work in Progress

Returns a reference to the database connector object used by the model.

Syntax

JDatabase &getDBO ()

Examples

Example

jimport( 'joomla.application.component.model' );

class HelloModelHellos extends JModel
{
	function __construct() {
		$config = array(
			'name' => 'MyModel',
			'table_path' => JPATH_COMPONENT.DS.'tables'
		);
		parent::__construct( $config );
	}
}

$model = new HelloModelHellos();

$db =& $model->getDBO();
echo $db->getVersion();

might produce

Result

5.0.38-Ubuntu_0ubuntu1-log

 
references/joomla.framework/application/jmodel-getdbo.txt (623 views) · Last modified: 2007/08/15 14:49