[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_privacy/src/Table/ -> RequestTable.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_requests table
  23   *
  24   * @property   integer  $id                        Item ID (primary key)
  25   * @property   string   $email                     The email address of the individual requesting the data
  26   * @property   string   $requested_at              The time the request was created at
  27   * @property   integer  $status                    The status of the information request
  28   * @property   string   $request_type              The type of information request
  29   * @property   string   $confirm_token             Hashed token for confirming the information request
  30   * @property   string   $confirm_token_created_at  The time the confirmation token was generated
  31   *
  32   * @since  3.9.0
  33   */
  34  class RequestTable extends Table
  35  {
  36      /**
  37       * Indicates that columns fully support the NULL value in the database
  38       *
  39       * @var    boolean
  40       * @since  4.0.0
  41       */
  42      protected $_supportNullValue = true;
  43  
  44      /**
  45       * The class constructor.
  46       *
  47       * @param   DatabaseDriver  $db  DatabaseDriver connector object.
  48       *
  49       * @since   3.9.0
  50       */
  51      public function __construct(DatabaseDriver $db)
  52      {
  53          parent::__construct('#__privacy_requests', 'id', $db);
  54      }
  55  
  56      /**
  57       * Method to store a row in the database from the Table instance properties.
  58       *
  59       * @param   boolean  $updateNulls  True to update fields even if they are null.
  60       *
  61       * @return  boolean  True on success.
  62       *
  63       * @since   3.9.0
  64       */
  65      public function store($updateNulls = true)
  66      {
  67          $date = Factory::getDate();
  68  
  69          // Set default values for new records
  70          if (!$this->id) {
  71              if (!$this->status) {
  72                  $this->status = '0';
  73              }
  74  
  75              if (!$this->requested_at) {
  76                  $this->requested_at = $date->toSql();
  77              }
  78  
  79              if (!$this->confirm_token_created_at) {
  80                  $this->confirm_token_created_at = null;
  81              }
  82          }
  83  
  84          return parent::store($updateNulls);
  85      }
  86  }


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