Sfoglia il codice sorgente

add more config info to Lock Protection cookbook

Matthew Webb 9 anni fa
parent
commit
9bf0180814
1 ha cambiato i file con 25 aggiunte e 0 eliminazioni
  1. 25 0
      Resources/doc/cookbook/recipe_lock_protection.rst

+ 25 - 0
Resources/doc/cookbook/recipe_lock_protection.rst

@@ -29,6 +29,31 @@ You can enable it in your ``sonata_admin`` configuration :
         sonata_admin:
             options:
                 lock_protection: true
+                
+You must also configure each entity that you want to support by adding a ``version`` field.
+
+.. code-block:: php
+
+    <?php
+    // src/AppBundle/Entity/Car.php
+    namespace AppBundle\Entity\Car;
+    
+    use Doctrine\ORM\Mapping as ORM;
+
+    class Car
+    {
+        // ...
+        
+        /**
+         * @ORM\Column(type="integer")
+         * @ORM\Version
+         */
+        protected $version;
+        
+        // ...
+    }
+
+For more information about this visit the `Doctrine docs <http://doctrine-orm.readthedocs.org/en/latest/reference/transactions-and-concurrency.html?highlight=optimistic#optimistic-locking>`_
 
 .. note::