Back to BeforeMoveEvent class

Method __construct

public
__construct
(mixed $name, array $arguments = array())
Constructor.
Parameters
  • string $name The event name.
  • array $arguments The event arguments.
-
  • \BadMethodCallException

Method __construct - Source code

/**
 * Constructor.
 *
 * Mandatory arguments:
 * subject		JTableInterface	The table we are operating on
 * query		DatabaseQuery	The query to get the primary keys and ordering values for the selection.
 * delta		int				The direction and magnitude to move the row in the ordering sequence.
 * where		string			WHERE clause to use for limiting the selection of rows to compact the ordering values.
 *
 * @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('query', $arguments)) {
        throw new BadMethodCallException("Argument 'query' is required for event {$name}");
    }
    if (!\array_key_exists('delta', $arguments)) {
        throw new BadMethodCallException("Argument 'delta' is required for event {$name}");
    }
    if (!\array_key_exists('where', $arguments)) {
        throw new BadMethodCallException("Argument 'where' is required for event {$name}");
    }
    parent::__construct($name, $arguments);
}