public function checkModel(ActiveRecord $model)
    {
        /** @var TrackableBehavior $behavior */
        if (($behavior = $this->getBehavior($model)) === null) {
            return null;
        }

        $auditTableName = $behavior->auditTableName;

        if (($pos=strpos($auditTableName, '.')) !== false) {
            $auditSchema = substr($auditTableName, 0, $pos);
        } else {
            $auditSchema = null;
        }
        $triggerTemplate = $this->triggerTemplate($model->getTableSchema()->name, $auditSchema);

        return [
            'enabled' => true,
            'valid' => $triggerTemplate['exists'],
        ];
    }
public function checkModel(ActiveRecord $model)
    {
        /** @var TrackableBehavior $behavior */
        if (($behavior = $this->getBehavior($model)) === null) {
            return null;
        }

        $auditTableName = $behavior->auditTableName;

        if (($pos=strpos($auditTableName, '.')) !== false) {
            $auditSchema = substr($auditTableName, 0, $pos);
        } else {
            $auditSchema = null;
        }
        $triggerTemplate = $this->triggerTemplate($model->getTableSchema()->name, $auditSchema);

        return [
            'enabled' => true,
            'valid' => $triggerTemplate['exists'],
        ];
    }
public function checkModel ( ActiveRecord $ model ) { /** @var TrackableBehavior $behavior */ if ( ( $ behavior = $ this -> getBehavior ( $ model ) ) === null ) { return null ; } $ auditTableName = $ behavior -> auditTableName ; if ( ( $ pos = strpos ( $ auditTableName , '.' ) ) !== false ) { $ auditSchema = substr ( $ auditTableName , 0 , $ pos ) ; } else { $ auditSchema = null ; } $ triggerTemplate = $ this -> triggerTemplate ( $ model -> getTableSchema ( ) -> name , $ auditSchema ) ; return [ 'enabled' => true , 'valid' => $ triggerTemplate [ 'exists' ] , ] ; }
Checks if audit objects for specified model exist and are valid.
@param ActiveRecord $model
@return array contains boolean keys: 'enabled' and 'valid'
@throws Exception
Checks if audit objects for specified model exist and are valid .