1
0
mirror of synced 2025-02-13 10:49:25 +03:00

[DX] Link annotation ref to locking explanation

The annotation reference contained no cross reference to the great
transaction and concurrency page. But this might be very useful for the
reader.
This commit is contained in:
David Fuhr 2015-07-07 18:45:56 +02:00
parent 33c2ae465d
commit de424be9f7
2 changed files with 20 additions and 5 deletions

View File

@ -1212,12 +1212,13 @@ Example with partial indexes:
.. _annref_version: .. _annref_version:
@Version @Version
~~~~~~~~~~~~~~ ~~~~~~~~
Marker annotation that defines a specified column as version Marker annotation that defines a specified column as version attribute used in
attribute used in an optimistic locking scenario. It only works on an :ref:`optimistic locking <transactions-and-concurrency_optimistic-locking>`
:ref:`@Column <annref_column>` annotations that have the type integer or scenario. It only works on :ref:`@Column <annref_column>` annotations that have
datetime. Combining @Version with :ref:`@Id <annref_id>` is not supported. the type ``integer`` or ``datetime``. Combining ``@Version`` with
:ref:`@Id <annref_id>` is not supported.
Example: Example:

View File

@ -1,6 +1,8 @@
Transactions and Concurrency Transactions and Concurrency
============================ ============================
.. _transactions-and-concurrency_transaction-demarcation:
Transaction Demarcation Transaction Demarcation
----------------------- -----------------------
@ -26,6 +28,8 @@ and control transaction demarcation yourself.
These are two ways to deal with transactions when using the These are two ways to deal with transactions when using the
Doctrine ORM and are now described in more detail. Doctrine ORM and are now described in more detail.
.. _transactions-and-concurrency_approach-implicitly:
Approach 1: Implicitly Approach 1: Implicitly
~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~
@ -49,6 +53,8 @@ the DML operations by the Doctrine ORM and is sufficient if all the
data manipulation that is part of a unit of work happens through data manipulation that is part of a unit of work happens through
the domain model and thus the ORM. the domain model and thus the ORM.
.. _transactions-and-concurrency_approach-explicitly:
Approach 2: Explicitly Approach 2: Explicitly
~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~
@ -104,6 +110,8 @@ abstraction flushes the ``EntityManager`` prior to transaction
commit and rolls back the transaction when an commit and rolls back the transaction when an
exception occurs. exception occurs.
.. _transactions-and-concurrency_exception-handling:
Exception Handling Exception Handling
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
@ -134,6 +142,8 @@ knowing that their state is potentially no longer accurate.
If you intend to start another unit of work after an exception has If you intend to start another unit of work after an exception has
occurred you should do that with a new ``EntityManager``. occurred you should do that with a new ``EntityManager``.
.. _transactions-and-concurrency_locking-support:
Locking Support Locking Support
--------------- ---------------
@ -142,6 +152,8 @@ strategies natively. This allows to take very fine-grained control
over what kind of locking is required for your Entities in your over what kind of locking is required for your Entities in your
application. application.
.. _transactions-and-concurrency_optimistic-locking:
Optimistic Locking Optimistic Locking
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
@ -305,6 +317,8 @@ And the change headline action (POST Request):
$post = $em->find('BlogPost', $postId, \Doctrine\DBAL\LockMode::OPTIMISTIC, $postVersion); $post = $em->find('BlogPost', $postId, \Doctrine\DBAL\LockMode::OPTIMISTIC, $postVersion);
.. _transactions-and-concurrency_pessimistic-locking:
Pessimistic Locking Pessimistic Locking
~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~