CoreFiles by mySites.guru
DatabaseAwareTrait.php69 lines, 1,310 bytes, from Joomla_4.2.0-beta2-Beta-Full_Package.zip
Raw History Compare with 4.2.0-beta1
md5
0f6cde23314106ee314c97a2ea2ac64c
sha1
fbbbbd3a70fac62069df03937faca5cbdbeacfa8
sha256
e97a06e6fec35fb7b31a4136c411d35043a855a506d29113e89696460d32b50d
<?php
/**
 * Joomla! Content Management System
 *
 * @copyright  (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\CMS\MVC\Model;

\defined('JPATH_PLATFORM') or die;

use Joomla\Database\DatabaseInterface;

/**
 * Database aware trait.
 *
 * @since  4.0.0
 *
 * @deprecated  5.0 Use the trait from the database package
 */
trait DatabaseAwareTrait
{
	/**
	 * The database driver.
	 *
	 * @var    DatabaseInterface
	 * @since  4.0.0
	 *
	 * @deprecated  5.0 Use the trait from the database package
	 */
	protected $_db;

	/**
	 * Get the database driver.
	 *
	 * @return  DatabaseInterface  The database driver.
	 *
	 * @since   4.0.0
	 * @throws  \UnexpectedValueException
	 *
	 * @deprecated  5.0 Use the trait from the database package
	 */
	public function getDbo()
	{
		if ($this->_db)
		{
			return $this->_db;
		}

		throw new \UnexpectedValueException('Database driver not set in ' . __CLASS__);
	}

	/**
	 * Set the database driver.
	 *
	 * @param   DatabaseInterface  $db  The database driver.
	 *
	 * @return  void
	 *
	 * @since   4.0.0
	 *
	 * @deprecated  5.0 Use the trait from the database package
	 */
	public function setDbo(DatabaseInterface $db = null)
	{
		$this->_db = $db;
	}
}

The same content is in 4 releases, Joomla 4.2.0-alpha2 to 4.2.0-beta2. See them all, or every version of this file.