本文整理汇总了PHP中Sequence::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Sequence::save方法的具体用法?PHP Sequence::save怎么用?PHP Sequence::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sequence
的用法示例。
在下文中一共展示了Sequence::save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _setFirstEditorData
/**
* if the object is inserted into the db for the first time some fields e.g. LK, firstEditor must be set
*/
private function _setFirstEditorData()
{
$this['firstEditor'] = Flat::user()->getLogicalKey();
$this['firstEditTime'] = new base_date_model_DateTime();
$seq = new Sequence(get_class($this));
$this['LK'] = $seq->getNextSequence();
$seq->save();
}
示例2: createAdminUser
/**
* creates the admin user
*
* @param OutputDevice $od
* @throws base_database_Exception
*/
public function createAdminUser(OutputDevice $od)
{
$user = new User();
if (!is_null($user->load(1))) {
return;
}
$seq = new Sequence('User');
$adminData['LK'] = $seq->getNextSequence();
$adminData['firstEditor'] = 1;
$dateTime = new base_date_model_DateTime();
$adminData['firstEditTime'] = $dateTime->toDB();
$adminData['editor'] = 1;
$adminData['editTime'] = $dateTime->toDB();
$adminData['userid'] = 'admin';
$adminData['password'] = '9118beb30f57be4ef758e0f2e81f12c4';
$adminData['firstName'] = 'Admin';
$adminData['lastName'] = 'Admin';
$adminData['email'] = 'support@faercher-it.de';
$statement = new base_database_statement_Insert();
$table = DB::table('user');
$statement->setTable($table);
foreach ($adminData as $fieldName => $value) {
$statement->setColumnValue($table->getColumn($fieldName), DB::term($value));
}
$dbObj = base_database_connection_Mysql::get();
$dbObj->beginTransaction();
$seq->save();
$statement->insertDatabase();
$dbObj->endTransaction();
base_install_Message::printOut('----- Admin User created -----', $od);
}