CoreFiles by mySites.guru
DatabaseAwareTrait.php67 lines, 1,414 bytes, from Joomla_4.2.0-beta3-Beta-Full_Package.zip
Raw History Compare with 4.2.0-beta2
md5
07ad7d76a79c681a34e2ebc5ae49332a
sha1
950f1ceb2c5980f041cd9e70f458741c7de93842
sha256
4139c8f782c84acc2a915088ab443571dc3830f59c76c4f308eb3784cd9b8c4e
<?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;

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 5 releases, Joomla 4.2.0-beta3 to 4.2.1-rc2. See them all, or every version of this file.