为什么 CakePHP 中的自动事务选项称为 "atomic"?

Why is the automatic transaction option in CakePHP is called "atomic"?

我不明白"atomic"这个词的意思。例如:

$conn = $this->ArticlesTable->connection();
$articles->save($entity, ['atomic' => false]); // <-- here
$conn->commit();

不应该是"autocommit"吗?

您实际上是在转 on/off "atomic" 笔交易,而不是 "automatic" 笔交易。

"Atomic" 是正确的术语:

An atomic transaction is an indivisible and irreducible series of database operations such that either all occur, or nothing occurs. A guarantee of atomicity prevents updates to the database occurring only partially, which can cause greater problems than rejecting the whole series outright.

-Wikipedia: Atomicity

那里的关键是“...这样要么全部发生,要么什么都不发生。”

当原子false(关闭),而你运行一个需要多个查询的保存,它会运行每个人都可以在某些人身上取得成功,但在其他人身上则不然。

当 atomic 为 true (on),而你 运行 一个需要多个查询的保存时,它会将它们作为一个单独处理交易,要么全部成功完成,要么全部失败。没有部分 saves/updates.