[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_banners/src/Table/ -> ClientTable.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_banners
   6   *
   7   * @copyright   (C) 2006 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\Banners\Administrator\Table;
  12  
  13  use Joomla\CMS\Language\Text;
  14  use Joomla\CMS\Table\Table;
  15  use Joomla\CMS\Versioning\VersionableTableInterface;
  16  use Joomla\Database\DatabaseDriver;
  17  
  18  // phpcs:disable PSR1.Files.SideEffects
  19  \defined('_JEXEC') or die;
  20  // phpcs:enable PSR1.Files.SideEffects
  21  
  22  /**
  23   * Client table
  24   *
  25   * @since  1.6
  26   */
  27  class ClientTable extends Table implements VersionableTableInterface
  28  {
  29      /**
  30       * Indicates that columns fully support the NULL value in the database
  31       *
  32       * @var    boolean
  33       * @since  4.0.0
  34       */
  35      protected $_supportNullValue = true;
  36  
  37      /**
  38       * Constructor
  39       *
  40       * @param   DatabaseDriver  $db  Database connector object
  41       *
  42       * @since   1.5
  43       */
  44      public function __construct(DatabaseDriver $db)
  45      {
  46          $this->typeAlias = 'com_banners.client';
  47  
  48          $this->setColumnAlias('published', 'state');
  49  
  50          parent::__construct('#__banner_clients', 'id', $db);
  51      }
  52  
  53      /**
  54       * Get the type alias for the history table
  55       *
  56       * @return  string  The alias as described above
  57       *
  58       * @since   4.0.0
  59       */
  60      public function getTypeAlias()
  61      {
  62          return $this->typeAlias;
  63      }
  64  
  65      /**
  66       * Overloaded check function
  67       *
  68       * @return  boolean  True if the object is ok
  69       *
  70       * @see     Table::check()
  71       * @since   4.0.0
  72       */
  73      public function check()
  74      {
  75          try {
  76              parent::check();
  77          } catch (\Exception $e) {
  78              $this->setError($e->getMessage());
  79  
  80              return false;
  81          }
  82  
  83          // Check for valid name
  84          if (trim($this->name) === '') {
  85              $this->setError(Text::_('COM_BANNERS_WARNING_PROVIDE_VALID_NAME'));
  86  
  87              return false;
  88          }
  89  
  90          // Check for valid contact
  91          if (trim($this->contact) === '') {
  92              $this->setError(Text::_('COM_BANNERS_PROVIDE_VALID_CONTACT'));
  93  
  94              return false;
  95          }
  96  
  97          return true;
  98      }
  99  }


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