Skip to content

Instantly share code, notes, and snippets.

@guweigang
Last active December 29, 2015 07:39
Show Gist options
  • Save guweigang/7637883 to your computer and use it in GitHub Desktop.
Save guweigang/7637883 to your computer and use it in GitHub Desktop.
<?php
/* DefaultEvent.php ---
*
* Filename: DefaultEvent.php
* Description:
* Author: Gu Weigang * Maintainer:
* Created: Fri Nov 8 16:34:55 2013 (+0800)
* Version: 116900
* Last-Updated: Wed Nov 13 16:46:24 2013 (+0800)
* By: Gu Weigang
* Update #: 57
*
*/
/* Change Log:
*
*
*/
/* This program is part of "Baidu Darwin PHP Software"; you can redistribute it and/or
* modify it under the terms of the Baidu General Private License as
* published by Baidu Campus.
*
* You should have received a copy of the Baidu General Private License
* along with this program; see the file COPYING. If not, write to
* the Baidu Campus NO.10 Shangdi 10th Street Haidian District, Beijing The People's
* Republic of China, 100085.
*/
/* Code: */
class DefaultEvent
{
protected function initEntry($assocData, $binlogInfo)
{
$entry = new Message($binlogInfo['db'], $binlogInfo['table']);
$entry->objectId = reset($assocData);
$entry->eventId = $binlogInfo['filename'].":".$binlogInfo['position'];
$entry->nestId = isset($assocData['nestId']) ? $assocData['nestId'] : 0;
$entry->userId = isset($assocData['userId']) ? $assocData['userId'] : 0;
return $entry;
}
protected function getModelClass($db, $table)
{
$modelClass = "\Adpipe\Models\\"
. str_replace("_", "", $db)
. "\\"
. ucfirst($table);
return $modelClass;
}
public function onWrite($data, &$message, $binlogInfo)
{
return false;
}
public function onUpdate($newData, $oldData, &$message, $binlogInfo)
{
return false;
}
public function onDelete($data, &$message, $binlogInfo)
{
return false;
}
}
/* DefaultEvent.php ends here */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment