Skip to content

Commit

Permalink
Fix phpdoc TransactionInterface classes. (#585)
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw authored Mar 7, 2023
1 parent 6f8e290 commit b3f4c3d
Showing 1 changed file with 26 additions and 22 deletions.
48 changes: 26 additions & 22 deletions src/Transaction/TransactionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@
use Yiisoft\Db\Exception\NotSupportedException;

/**
* The TransactionInterface defines the interface for a database transaction. A transaction is a set of operations that
* are executed as a single logical unit of work. The main benefit of using transactions is that they allow for the
* atomic, consistent, isolated for multiple database operations.
* Defines the interface for a database transaction.
*
* The TransactionInterface class defines several methods for working with transactions, such as `begin()`, `commit()`,
* and `rollBack()`.
* A transaction is a set of operations that are executed as a single logical unit of work.
*
* The main benefit of using transactions is that they allow for the atomic, consistent, isolated for many database
* operations.
*
* The class defines several methods for working with transactions, such as {@see begin()}, {@see commit()}, and
* {@see rollBack()}.
*/
interface TransactionInterface extends LoggerAwareInterface
{
Expand Down Expand Up @@ -50,32 +53,33 @@ interface TransactionInterface extends LoggerAwareInterface
*
* @param string|null $isolationLevel The {@see isolation level}[] to use for this transaction.
* This can be one of {@see READ_UNCOMMITTED}, {@see READ_COMMITTED}, {@see REPEATABLE_READ} and {@see SERIALIZABLE}
* but also a string containing DBMS specific syntax to be used after `SET TRANSACTION ISOLATION LEVEL`.
* but also a string containing DBMS-specific syntax to be used after `SET TRANSACTION ISOLATION LEVEL`.
* If not specified (`null`), the isolation level won't be set explicitly and the DBMS default will be used.
*
* If not specified (`null`) the isolation level will not be set explicitly and the DBMS default will be used.
* Note: This setting doesn't work for PostgresSQL, where setting the isolation level before the transaction has no
* effect.
*
* > Note: This setting does not work for PostgresSQL, where setting the isolation level before the transaction has
* no effect. You have to call {@see setIsolationLevel()} in this case after the transaction has started.
* You have to call {@see setIsolationLevel()} in this case after the transaction has started.
*
* > Note: Some (DBMS) allow setting of the isolation level only for the whole connection so subsequent transactions
* may get the same isolation level even if you did not specify any. When using this feature you may need to set the
* Note: Some (DBMS) allow setting of the isolation level only for the whole connection so later transactions may
* get the same isolation level even if you didn't specify any. When using this feature, you may need to set the
* isolation level for all transactions explicitly to avoid conflicting settings.
* At the time of this writing affected DBMS are MSSQL and SQLite.
*
* [isolation level]: http://en.wikipedia.org/wiki/Isolation_%28database_systems%29#Isolation_levels
* @link http://en.wikipedia.org/wiki/Isolation_%28database_systems%29#Isolation_levels
*
* @throws Exception
* @throws Throwable If DB connection fails or the current transaction is active.
* @throws InvalidConfigException If {@see \Yiisoft\Db\Connection\ConnectionInterface} is `null` or invalid.
* @throws NotSupportedException If the DBMS does not support nested transactions or the transaction is active.
* @throws NotSupportedException If the DBMS doesn't support nested transactions or the transaction is active.
*/
public function begin(string $isolationLevel = null): void;

/**
* Commits a transaction.
*
* @throws Exception
* @throws Throwable If the transaction is not active
* @throws Throwable If the transaction isn't active
*/
public function commit(): void;

Expand Down Expand Up @@ -105,24 +109,24 @@ public function rollBack(): void;
* Sets the transaction isolation level for this transaction.
*
* This method can be used to set the isolation level while the transaction is already active.
* However, this is not supported by all DBMS, so you might rather specify the isolation level directly when calling
* However, this isn't supported by all DBMS, so you might rather specify the isolation level directly when calling
* {@see begin()}.
*
* @param string $level The transaction isolation level to use for this transaction.
* This can be one of {@see READ_UNCOMMITTED}, {@see READ_COMMITTED}, {@see REPEATABLE_READ} and {@see SERIALIZABLE}
* but also a string containing DBMS specific syntax to be used after `SET TRANSACTION ISOLATION LEVEL`.
* but also a string containing DBMS-specific syntax to be used after `SET TRANSACTION ISOLATION LEVEL`.
*
* @throws Exception
* @throws Throwable If the transaction is not active.
* @throws Throwable If the transaction isn't active.
*
* @see http://en.wikipedia.org/wiki/Isolation_%28database_systems%29#Isolation_levels
* @link http://en.wikipedia.org/wiki/Isolation_%28database_systems%29#Isolation_levels
*/
public function setIsolationLevel(string $level): void;

/**
* Creates a new savepoint.
*
* @param string $name the savepoint name
* @param string $name The savepoint name.
*
* @throws Exception
* @throws InvalidConfigException
Expand All @@ -131,9 +135,9 @@ public function setIsolationLevel(string $level): void;
public function createSavepoint(string $name): void;

/**
* Rolls back to a previously created savepoint.
* Rolls back to a before created savepoint.
*
* @param string $name The savepoint name
* @param string $name The savepoint name.
*
* @throws Exception
* @throws InvalidConfigException
Expand All @@ -144,7 +148,7 @@ public function rollBackSavepoint(string $name): void;
/**
* Releases an existing savepoint.
*
* @param string $name the savepoint name
* @param string $name The savepoint name.
*
* @throws Exception
* @throws InvalidConfigException
Expand Down

0 comments on commit b3f4c3d

Please sign in to comment.