本文整理汇总了PHP中Illuminate\Database\Connection::commit方法的典型用法代码示例。如果您正苦于以下问题:PHP Connection::commit方法的具体用法?PHP Connection::commit怎么用?PHP Connection::commit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Database\Connection
的用法示例。
在下文中一共展示了Connection::commit方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: storeMultiple
/**
* Save multiple notifications sent
* at once.
*
* @param array $notifications
* @return mixed
*/
public function storeMultiple(array $notifications)
{
$this->db->beginTransaction();
$stackId = $this->db->table($this->notification->getTable())->max('stack_id') + 1;
foreach ($notifications as $key => $notification) {
$notifications[$key]['stack_id'] = $stackId;
}
$insert = $this->db->table($this->notification->getTable())->insert($notifications);
$this->db->commit();
return $insert;
}
示例2: append
/**
* @param mixed $id
* @param DomainEventStream $eventStream
*/
public function append($id, DomainEventStream $eventStream)
{
$id = (string) $id;
//Used to thrown errors if ID will not cast to string
$this->db->beginTransaction();
try {
foreach ($eventStream as $domainMessage) {
$this->insertEvent($domainMessage);
}
$this->db->commit();
} catch (QueryException $ex) {
$this->db->rollBack();
throw $ex;
}
}
示例3: deleteReserved
/**
* Delete a reserved job from the queue.
*
* @param string $queue
* @param string $id
* @return void
*/
public function deleteReserved($queue, $id)
{
$this->database->beginTransaction();
if ($this->database->table($this->table)->lockForUpdate()->find($id)) {
$this->database->table($this->table)->where('id', $id)->delete();
}
$this->database->commit();
}
示例4: pop
/**
* Pop the next job off of the queue.
*
* @param string $queue
* @return \Illuminate\Contracts\Queue\Job|null
*/
public function pop($queue = null)
{
$queue = $this->getQueue($queue);
if (!is_null($this->expire)) {
$this->releaseJobsThatHaveBeenReservedTooLong($queue);
}
if ($job = $this->getNextAvailableJob($queue)) {
$this->markJobAsReserved($job->_id);
return new MongodbJob($this->container, $this, $job, $queue);
}
$this->database->commit();
}