CoreFiles by mySites.guru
BeforeLoadEvent.php61 lines, 1,475 bytes, from Joomla_4.2.0-beta2-Beta-Full_Package.zip
Raw History Compare with 4.2.0-beta1
md5
331050330e0ce3dbe2cef47e7a3a7fe3
sha1
9dc99c3c2f7187d97407dcc0b6728623de7a9271
sha256
756db4ba8f1d21ea05a3ef9d25d3024564b2c82faa5d24f48fd29bc23a05686f
<?php
/**
 * Joomla! Content Management System
 *
 * @copyright  (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
 * @license    GNU General Public License version 2 or later; see LICENSE
 */

namespace Joomla\CMS\Event\Table;

\defined('JPATH_PLATFORM') or die;

use BadMethodCallException;

/**
 * Event class for JTable's onBeforeLoad event
 *
 * @since  4.0.0
 */
class BeforeLoadEvent extends AbstractEvent
{
	/**
	 * Constructor.
	 *
	 * Mandatory arguments:
	 * subject	JTableInterface	The table we are operating on
	 * keys		mixed			The optional primary key value to load the row by, or an array of fields to match.
	 * reset	boolean			True to reset the default values before loading the new row.
	 *
	 * @param   string  $name       The event name.
	 * @param   array   $arguments  The event arguments.
	 *
	 * @throws  BadMethodCallException
	 */
	public function __construct($name, array $arguments = array())
	{
		if (!\array_key_exists('keys', $arguments))
		{
			throw new BadMethodCallException("Argument 'keys' is required for event $name");
		}

		if (!\array_key_exists('reset', $arguments))
		{
			throw new BadMethodCallException("Argument 'reset' is required for event $name");
		}

		parent::__construct($name, $arguments);
	}

	/**
	 * Setter for the reset attribute
	 *
	 * @param   mixed  $value  The value to set
	 *
	 * @return  boolean  Normalised value
	 */
	protected function setReset($value)
	{
		return $value ? true : false;
	}
}

The same content is in 51 releases, Joomla 4.0.0-beta6 to 4.2.0-beta2. See them all, or every version of this file.