qiuxis 2016-12-16 11:13:58 318次浏览 0条回复 1 0 0

基本是Yii2 事件的集合了,如果有缺少的话,留言补充!
yii2 事件 event (1) —— yii2启示录
yii2 事件 event (2) —— yii2启示录

  • // yii2\db\BaseActiveRecord.php
    /**
     *  Event an event that is triggered when the record is initialized via init().
     */
    const EVENT_INIT = 'init';
    /**
     *  Event an event that is triggered after the record is created and populated with query result.
     */
    const EVENT_AFTER_FIND = 'afterFind';
    /**
     *  ModelEvent an event that is triggered before inserting a record.
     * You may set ModelEvent::isValid to be false to stop the insertion.
     */
    const EVENT_BEFORE_INSERT = 'beforeInsert';
    /**
     *  AfterSaveEvent an event that is triggered after a record is inserted.
     */
    const EVENT_AFTER_INSERT = 'afterInsert';
    /**
     *  ModelEvent an event that is triggered before updating a record.
     * You may set ModelEvent::isValid to be false to stop the update.
     */
    const EVENT_BEFORE_UPDATE = 'beforeUpdate';
    /**
     *  AfterSaveEvent an event that is triggered after a record is updated.
     */
    const EVENT_AFTER_UPDATE = 'afterUpdate';
    /**
     *  ModelEvent an event that is triggered before deleting a record.
     * You may set ModelEvent::isValid to be false to stop the deletion.
     */
    const EVENT_BEFORE_DELETE = 'beforeDelete';
    /**
     *  Event an event that is triggered after a record is deleted.
     */
    const EVENT_AFTER_DELETE = 'afterDelete';
    /**
     *  Event an event that is triggered after a record is refreshed.
     * @since 2.0.8
     */
    const EVENT_AFTER_REFRESH = 'afterRefresh';
  • // yii2\base\Application
    /**
     *  Event an event raised before the application starts to handle a request.
     */
    const EVENT_BEFORE_REQUEST = 'beforeRequest';
    /**
     *  Event an event raised after the application successfully handles a request (before the response is sent out).
     */
    const EVENT_AFTER_REQUEST = 'afterRequest';
  • // yii2\base\Module
    /**
     *  ActionEvent an event raised before executing a controller action.
     * You may set ActionEvent::isValid to be false to cancel the action execution.
     */
    const EVENT_BEFORE_ACTION = 'beforeAction';
    /**
     *  ActionEvent an event raised after executing a controller action.
     */
    const EVENT_AFTER_ACTION = 'afterAction';
  • // yii2\base\Model
    /**
     *  ModelEvent an event raised at the beginning of validate(). You may set
     * ModelEvent::isValid to be false to stop the validation.
     */
    const EVENT_BEFORE_VALIDATE = 'beforeValidate';
    /**
     *  Event an event raised at the end of validate()
     */
    const EVENT_AFTER_VALIDATE = 'afterValidate';
	
  • // yii2\base\View
    /**
     *  Event an event that is triggered by beginPage().
     */
    const EVENT_BEGIN_PAGE = 'beginPage';
    /**
     *  Event an event that is triggered by endPage().
     */
    const EVENT_END_PAGE = 'endPage';
    /**
     *  ViewEvent an event that is triggered by renderFile() right before it renders a view file.
     */
    const EVENT_BEFORE_RENDER = 'beforeRender';
    /**
     *  ViewEvent an event that is triggered by renderFile() right after it renders a view file.
     */
    const EVENT_AFTER_RENDER = 'afterRender';
  • // yii2\web\View
    /**
     *  Event an event that is triggered by beginBody().
     */
    const EVENT_BEGIN_BODY = 'beginBody';
    /**
     *  Event an event that is triggered by endBody().
     */
    const EVENT_END_BODY = 'endBody';	
  • // yii2\web\User
    const EVENT_BEFORE_LOGIN = 'beforeLogin';
    const EVENT_AFTER_LOGIN = 'afterLogin';
    const EVENT_BEFORE_LOGOUT = 'beforeLogout';
    const EVENT_AFTER_LOGOUT = 'afterLogout';
  • // yii2\web\Response
    /**
     *  ResponseEvent an event that is triggered at the beginning of send().
     */
    const EVENT_BEFORE_SEND = 'beforeSend';
    /**
     *  ResponseEvent an event that is triggered at the end of send().
     */
    const EVENT_AFTER_SEND = 'afterSend';
    /**
     *  ResponseEvent an event that is triggered right after prepare() is called in send().
     * You may respond to this event to filter the response content before it is sent to the client.
     */
    const EVENT_AFTER_PREPARE = 'afterPrepare';	
  • // yii2\db\Connection
    /**
     *  Event an event that is triggered after a DB connection is established
     */
    const EVENT_AFTER_OPEN = 'afterOpen';
    /**
     *  Event an event that is triggered right before a top-level transaction is started
     */
    const EVENT_BEGIN_TRANSACTION = 'beginTransaction';
    /**
     *  Event an event that is triggered right after a top-level transaction is committed
     */
    const EVENT_COMMIT_TRANSACTION = 'commitTransaction';
    /**
     *  Event an event that is triggered right after a top-level transaction is rolled back
     */
    const EVENT_ROLLBACK_TRANSACTION = 'rollbackTransaction';
    没有找到数据。
您需要登录后才可以回复。登录 | 立即注册
在线
181