CoreFiles by mySites.guru
BeforeLoadEvent.php60 lines, 1,735 bytes, from Joomla_5.0.0-beta2-Beta-Full_Package.zip
Raw History Compare with 5.0.0-beta1
md5
b214db68857655290cb7e10172e2a913
sha1
63ddd481ab153729d60e072470ea24e552aa3a95
sha256
7509ec623b7b25773ad4306da2810ea5d8833b974d25c60d6fe5f305d434be40
<?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.txt
 */

namespace Joomla\CMS\Event\Table;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
 * Event class for \Joomla\CMS\Table\Table onBeforeLoad event
 *
 * @since  4.0.0
 */
class BeforeLoadEvent extends AbstractEvent
{
    /**
     * Constructor.
     *
     * Mandatory arguments:
     * subject  \Joomla\CMS\Table\TableInterface 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 = [])
    {
        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 4 releases, Joomla 5.0.0-alpha3 to 5.0.0-beta2. See them all, or every version of this file.