[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_privacy/src/Table/ -> ConsentTable.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_privacy
   6   *
   7   * @copyright   (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9   */
  10  
  11  namespace Joomla\Component\Privacy\Administrator\Table;
  12  
  13  use Joomla\CMS\Factory;
  14  use Joomla\CMS\Table\Table;
  15  use Joomla\Database\DatabaseDriver;
  16  
  17  // phpcs:disable PSR1.Files.SideEffects
  18  \defined('_JEXEC') or die;
  19  // phpcs:enable PSR1.Files.SideEffects
  20  
  21  /**
  22   * Table interface class for the #__privacy_consents table
  23   *
  24   * @property   integer  $id       Item ID (primary key)
  25   * @property   integer  $remind   The status of the reminder request
  26   * @property   string   $token    Hashed token for the reminder request
  27   * @property   integer  $user_id  User ID (pseudo foreign key to the #__users table) if the request is associated to a user account
  28   *
  29   * @since  3.9.0
  30   */
  31  class ConsentTable extends Table
  32  {
  33      /**
  34       * The class constructor.
  35       *
  36       * @param   DatabaseDriver  $db  DatabaseInterface connector object.
  37       *
  38       * @since   3.9.0
  39       */
  40      public function __construct(DatabaseDriver $db)
  41      {
  42          parent::__construct('#__privacy_consents', 'id', $db);
  43      }
  44  
  45      /**
  46       * Method to store a row in the database from the Table instance properties.
  47       *
  48       * @param   boolean  $updateNulls  True to update fields even if they are null.
  49       *
  50       * @return  boolean  True on success.
  51       *
  52       * @since   3.9.0
  53       */
  54      public function store($updateNulls = false)
  55      {
  56          $date = Factory::getDate();
  57  
  58          // Set default values for new records
  59          if (!$this->id) {
  60              if (!$this->remind) {
  61                  $this->remind = '0';
  62              }
  63  
  64              if (!$this->created) {
  65                  $this->created = $date->toSql();
  66              }
  67          }
  68  
  69          return parent::store($updateNulls);
  70      }
  71  }


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