src/Model/Behavior/UserBehavior.php
protected function _getUser($value, $options = []) {
		$defaults = [
			'notFoundErrorMessage' => __d('user_tools', 'User not found.'),
			'field' => $this->_table->aliasField($this->_table->getPrimaryKey())
		];
		$defaults = Hash::merge($defaults, $this->getConfig('getUser'));

		if (isset($options['field'])) {
			$defaults['field'] = $options['field'];
		}
		$options = Hash::merge($defaults, $options);

		$query = $this->_getFindUserQuery($value, $options);

		if (isset($options['queryCallback']) && is_callable($options['queryCallback'])) {
			$query = $options['queryCallback']($query, $options);
		}

		$result = $query->first();

		if (empty($result)) {
			throw new RecordNotFoundException($options['notFoundErrorMessage']);
		}

		return $result;
	}
protected function _getUser($value, $options = []) {
		$defaults = [
			'notFoundErrorMessage' => __d('user_tools', 'User not found.'),
			'field' => $this->_table->aliasField($this->_table->getPrimaryKey())
		];
		$defaults = Hash::merge($defaults, $this->getConfig('getUser'));

		if (isset($options['field'])) {
			$defaults['field'] = $options['field'];
		}
		$options = Hash::merge($defaults, $options);

		$query = $this->_getFindUserQuery($value, $options);

		if (isset($options['queryCallback']) && is_callable($options['queryCallback'])) {
			$query = $options['queryCallback']($query, $options);
		}

		$result = $query->first();

		if (empty($result)) {
			throw new RecordNotFoundException($options['notFoundErrorMessage']);
		}

		return $result;
	}
protected function _getUser ( $ value , $ options = [ ] ) { $ defaults = [ 'notFoundErrorMessage' => __d ( 'user_tools' , 'User not found.' ) , 'field' => $ this -> _table -> aliasField ( $ this -> _table -> getPrimaryKey ( ) ) ] ; $ defaults = Hash :: merge ( $ defaults , $ this -> getConfig ( 'getUser' ) ) ; if ( isset ( $ options [ 'field' ] ) ) { $ defaults [ 'field' ] = $ options [ 'field' ] ; } $ options = Hash :: merge ( $ defaults , $ options ) ; $ query = $ this -> _getFindUserQuery ( $ value , $ options ) ; if ( isset ( $ options [ 'queryCallback' ] ) && is_callable ( $ options [ 'queryCallback' ] ) ) { $ query = $ options [ 'queryCallback' ] ( $ query , $ options ) ; } $ result = $ query -> first ( ) ; if ( empty ( $ result ) ) { throw new RecordNotFoundException ( $ options [ 'notFoundErrorMessage' ] ) ; } return $ result ; }
Finds the user for the password reset.

Extend the behavior and override this method if the configuration options
are not sufficient.

@param mixed $value User lookup value
@param array $options Options
@throws \Cake\Datasource\Exception\RecordNotFoundException
@return \Cake\Datasource\EntityInterface
Finds the user for the password reset .