public function safeUp() { /** @var ActiveRecordLog $log */ foreach (ActiveRecordLog::model()->findAll('`description` LIKE :text', [':text' => '%Guest%']) as $log) { $log->userid = null; $log->save(); } }
public function safeUp() { $this->addColumn('{{group_replace}}', 'owner', 'string NOT NULL'); $replaces = GroupReplace::model()->findAll(); foreach ($replaces as $replace) { $log = ActiveRecordLog::model()->findByAttributes(['model' => 'GroupReplace', 'idModel' => $replace->id, 'action' => 'CREATE']); if ($log) { $log = explode(' ', $log->description); $replace->owner = $log[1]; $replace->save(); } } }
public function run() { $this->widget('zii.widgets.grid.CGridView', array('id' => 'alkardex-grid', 'dataProvider' => ActiveRecordLog::model()->search_por_modelo($this->modeloapintar, $this->clave), 'itemsCssClass' => 'table table-striped table-bordered table-hover', 'columns' => array(array('name' => 'action', 'header' => 'Accion'), array('name' => 'Usuario', 'header' => 'Usuario', 'value' => 'Yii::app()->user->um->loadUserById($data->userid)->username'), array('name' => 'nombrecampo', 'header' => 'Campo afectado'), array('name' => 'creationdate', 'header' => 'Fecha'), array('name' => 'oldvalue', 'header' => 'Valor anterior'), array('name' => 'newvalue', 'header' => 'Valor actualizado')))); }