mirror of
https://github.com/Mibew/mibew.git
synced 2025-02-07 16:24:43 +03:00
Add event on operator create
This commit is contained in:
parent
2dca8f236e
commit
a34cb53e91
@ -56,6 +56,16 @@ final class Events
|
||||
*/
|
||||
const OPERATOR_LOGOUT = 'operatorLogout';
|
||||
|
||||
/**
|
||||
* An operator is created.
|
||||
*
|
||||
* This event is triggered after an operator has been created. An
|
||||
* associative array with the following items is passed to the event
|
||||
* handlers:
|
||||
* - "operator": operator's array.
|
||||
*/
|
||||
const OPERATOR_CREATE = 'operatorCreate';
|
||||
|
||||
/**
|
||||
* An operator is deleted.
|
||||
*
|
||||
|
@ -357,6 +357,8 @@ function update_operator_avatar($operator_id, $avatar)
|
||||
/**
|
||||
* Create new operator
|
||||
*
|
||||
* Triggers {@link \Mibew\EventDispatcher\Events::OPERATOR_CREATE} event.
|
||||
*
|
||||
* @param string $login Operator's login
|
||||
* @param string $email Operator's
|
||||
* @param string $password Operator's password
|
||||
@ -398,12 +400,16 @@ function create_operator(
|
||||
);
|
||||
|
||||
$id = $db->insertedId();
|
||||
|
||||
return $db->query(
|
||||
$new_operator = $db->query(
|
||||
"SELECT * FROM {operator} WHERE operatorid = ?",
|
||||
array($id),
|
||||
array('return_rows' => Database::RETURN_ONE_ROW)
|
||||
);
|
||||
|
||||
$event = array('operator' => $new_operator);
|
||||
EventDispatcher::getInstance()->triggerEvent(Events::OPERATOR_CREATE, $event);
|
||||
|
||||
return $new_operator;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user