[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * Joomla! Content Management System 5 * 6 * @copyright (C) 2008 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\Table; 11 12 use Joomla\CMS\Language\Text; 13 use Joomla\Database\DatabaseDriver; 14 15 // phpcs:disable PSR1.Files.SideEffects 16 \defined('JPATH_PLATFORM') or die; 17 // phpcs:enable PSR1.Files.SideEffects 18 19 /** 20 * Update table 21 * Stores updates temporarily 22 * 23 * @since 1.7.0 24 */ 25 class Update extends Table 26 { 27 /** 28 * Ensure the params in json encoded in the bind method 29 * 30 * @var array 31 * @since 4.0.0 32 */ 33 protected $_jsonEncode = ['params']; 34 35 /** 36 * Constructor 37 * 38 * @param DatabaseDriver $db Database driver object. 39 * 40 * @since 1.7.0 41 */ 42 public function __construct(DatabaseDriver $db) 43 { 44 parent::__construct('#__updates', 'update_id', $db); 45 } 46 47 /** 48 * Overloaded check function 49 * 50 * @return boolean True if the object is ok 51 * 52 * @see Table::check() 53 * @since 1.7.0 54 */ 55 public function check() 56 { 57 try { 58 parent::check(); 59 } catch (\Exception $e) { 60 $this->setError($e->getMessage()); 61 62 return false; 63 } 64 65 // Check for valid name 66 if (trim($this->name) == '' || trim($this->element) == '') { 67 $this->setError(Text::_('JLIB_DATABASE_ERROR_MUSTCONTAIN_A_TITLE_EXTENSION')); 68 69 return false; 70 } 71 72 if (!$this->update_id && !$this->data) { 73 $this->data = ''; 74 } 75 76 // While column is not nullable, make sure we have a value. 77 if ($this->description === null) { 78 $this->description = ''; 79 } 80 81 return true; 82 } 83 84 /** 85 * Method to create and execute a SELECT WHERE query. 86 * 87 * @param array $options Array of options 88 * 89 * @return string Results of query 90 * 91 * @since 1.7.0 92 */ 93 public function find($options = array()) 94 { 95 $where = array(); 96 97 foreach ($options as $col => $val) { 98 $where[] = $col . ' = ' . $this->_db->quote($val); 99 } 100 101 $query = $this->_db->getQuery(true) 102 ->select($this->_db->quoteName($this->_tbl_key)) 103 ->from($this->_db->quoteName($this->_tbl)) 104 ->where(implode(' AND ', $where)); 105 $this->_db->setQuery($query); 106 107 return $this->_db->loadResult(); 108 } 109 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |