Skip to content

Instantly share code, notes, and snippets.

@Blizzke
Created July 12, 2015 10:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Blizzke/7ed3467573cf9b3e08ca to your computer and use it in GitHub Desktop.
Save Blizzke/7ed3467573cf9b3e08ca to your computer and use it in GitHub Desktop.
AuditEntry
public function addBatchData($batchData, $compact = true)
{
$columns = ['entry_id', 'type', 'data'];
$rows = [];
foreach ($batchData as $type => $data) {
$rows[] = [$this->id, $type, [Helper::serialize($data, $compact), \PDO::PARAM_LOB]];
}
static::getDb()->createCommand()->batchInsert(AuditData::tableName(), $columns, $rows)->execute();
}
public function addData($type, $data, $compact = true)
{
$record = ['entry_id' => $this->id, 'type' => $type, 'data' => [Helper::serialize($data, $compact), \PDO::PARAM_LOB]];
static::getDb()->createCommand()->insert(AuditData::tableName(), $record)->execute();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment