[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/src/MVC/Model/ -> DatabaseAwareTrait.php (source)

   1  <?php
   2  
   3  /**
   4   * Joomla! Content Management System
   5   *
   6   * @copyright  (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
   7   * @license    GNU General Public License version 2 or later; see LICENSE.txt
   8   */
   9  
  10  namespace Joomla\CMS\MVC\Model;
  11  
  12  use Joomla\Database\DatabaseInterface;
  13  
  14  // phpcs:disable PSR1.Files.SideEffects
  15  \defined('JPATH_PLATFORM') or die;
  16  // phpcs:enable PSR1.Files.SideEffects
  17  
  18  /**
  19   * Database aware trait.
  20   *
  21   * @since  4.0.0
  22   *
  23   * @deprecated  5.0 Use the trait from the database package
  24   */
  25  trait DatabaseAwareTrait
  26  {
  27      /**
  28       * The database driver.
  29       *
  30       * @var    DatabaseInterface
  31       * @since  4.0.0
  32       *
  33       * @deprecated  5.0 Use the trait from the database package
  34       */
  35      protected $_db;
  36  
  37      /**
  38       * Get the database driver.
  39       *
  40       * @return  DatabaseInterface  The database driver.
  41       *
  42       * @since   4.0.0
  43       * @throws  \UnexpectedValueException
  44       *
  45       * @deprecated  5.0 Use the trait from the database package
  46       */
  47      public function getDbo()
  48      {
  49          if ($this->_db) {
  50              return $this->_db;
  51          }
  52  
  53          throw new \UnexpectedValueException('Database driver not set in ' . __CLASS__);
  54      }
  55  
  56      /**
  57       * Set the database driver.
  58       *
  59       * @param   DatabaseInterface  $db  The database driver.
  60       *
  61       * @return  void
  62       *
  63       * @since   4.0.0
  64       *
  65       * @deprecated  5.0 Use the trait from the database package
  66       */
  67      public function setDbo(DatabaseInterface $db = null)
  68      {
  69          $this->_db = $db;
  70      }
  71  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer