Added examples for version column in the xml and yml formats
This commit is contained in:
parent
e7856f90d8
commit
53cd9c4ca8
@ -187,30 +187,68 @@ has been modified by someone else already.
|
|||||||
You designate a version field in an entity as follows. In this
|
You designate a version field in an entity as follows. In this
|
||||||
example we'll use an integer.
|
example we'll use an integer.
|
||||||
|
|
||||||
.. code-block:: php
|
.. configuration-block::
|
||||||
|
|
||||||
<?php
|
.. code-block:: php
|
||||||
class User
|
|
||||||
{
|
<?php
|
||||||
// ...
|
class User
|
||||||
/** @Version @Column(type="integer") */
|
{
|
||||||
private $version;
|
// ...
|
||||||
// ...
|
/** @Version @Column(type="integer") */
|
||||||
}
|
private $version;
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
|
||||||
|
.. code-block:: xml
|
||||||
|
|
||||||
|
<doctrine-mapping>
|
||||||
|
<entity name="User">
|
||||||
|
<field name="version" type="integer" version="true" />
|
||||||
|
</entity>
|
||||||
|
</doctrine-mapping>
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
User:
|
||||||
|
type: entity
|
||||||
|
fields:
|
||||||
|
version:
|
||||||
|
version:
|
||||||
|
type: integer
|
||||||
|
|
||||||
Alternatively a datetime type can be used (which maps to a SQL
|
Alternatively a datetime type can be used (which maps to a SQL
|
||||||
timestamp or datetime):
|
timestamp or datetime):
|
||||||
|
|
||||||
.. code-block:: php
|
.. configuration-block::
|
||||||
|
|
||||||
<?php
|
.. code-block:: php
|
||||||
class User
|
|
||||||
{
|
<?php
|
||||||
// ...
|
class User
|
||||||
/** @Version @Column(type="datetime") */
|
{
|
||||||
private $version;
|
// ...
|
||||||
// ...
|
/** @Version @Column(type="datetime") */
|
||||||
}
|
private $version;
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
|
||||||
|
.. code-block:: xml
|
||||||
|
|
||||||
|
<doctrine-mapping>
|
||||||
|
<entity name="User">
|
||||||
|
<field name="version" type="datetime" version="true" />
|
||||||
|
</entity>
|
||||||
|
</doctrine-mapping>
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
User:
|
||||||
|
type: entity
|
||||||
|
fields:
|
||||||
|
version:
|
||||||
|
version:
|
||||||
|
type: datetime
|
||||||
|
|
||||||
Version numbers (not timestamps) should however be preferred as
|
Version numbers (not timestamps) should however be preferred as
|
||||||
they can not potentially conflict in a highly concurrent
|
they can not potentially conflict in a highly concurrent
|
||||||
|
Loading…
x
Reference in New Issue
Block a user