[ 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) 2016 Open Source Matters, Inc. <https://www.joomla.org> 7 * @license GNU General Public License version 2 or later; see LICENSE 8 */ 9 10 namespace Joomla\CMS\Event\Table; 11 12 use BadMethodCallException; 13 use Joomla\Database\DatabaseQuery; 14 15 // phpcs:disable PSR1.Files.SideEffects 16 \defined('JPATH_PLATFORM') or die; 17 // phpcs:enable PSR1.Files.SideEffects 18 19 /** 20 * Event class for JTable's onBeforeReorder event 21 * 22 * @since 4.0.0 23 */ 24 class BeforeReorderEvent extends AbstractEvent 25 { 26 /** 27 * Constructor. 28 * 29 * Mandatory arguments: 30 * subject JTableInterface The table we are operating on 31 * query DatabaseQuery The query to get the primary keys and ordering values for the selection. 32 * where string WHERE clause to use for limiting the selection of rows to compact the ordering values. 33 * 34 * @param string $name The event name. 35 * @param array $arguments The event arguments. 36 * 37 * @throws BadMethodCallException 38 */ 39 public function __construct($name, array $arguments = array()) 40 { 41 if (!\array_key_exists('query', $arguments)) { 42 throw new BadMethodCallException("Argument 'query' is required for event $name"); 43 } 44 45 if (!\array_key_exists('where', $arguments)) { 46 throw new BadMethodCallException("Argument 'where' is required for event $name"); 47 } 48 49 parent::__construct($name, $arguments); 50 } 51 52 /** 53 * Setter for the query argument 54 * 55 * @param DatabaseQuery $value The value to set 56 * 57 * @return mixed 58 * 59 * @throws BadMethodCallException if the argument is not of the expected type 60 */ 61 protected function setQuery($value) 62 { 63 if (!($value instanceof DatabaseQuery)) { 64 throw new BadMethodCallException("Argument 'query' of event {$this->name} must be of DatabaseQuery type"); 65 } 66 67 return $value; 68 } 69 70 /** 71 * Setter for the where argument 72 * 73 * @param array|string|null $value A string or array of where conditions. 74 * 75 * @return mixed 76 * 77 * @throws BadMethodCallException if the argument is not of the expected type 78 */ 79 protected function setWhere($value) 80 { 81 if (!empty($value) && !\is_string($value) && !\is_array($value)) { 82 throw new BadMethodCallException("Argument 'where' of event {$this->name} must be empty or string or array of strings"); 83 } 84 85 return $value; 86 } 87 }
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 |