Merge pull request #6138 from WhiteEagle88/version-docs
Added examples for version column in the xml and yml formats
This commit is contained in:
commit
95d9c64aec
@ -187,6 +187,8 @@ 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.
|
||||||
|
|
||||||
|
.. configuration-block::
|
||||||
|
|
||||||
.. code-block:: php
|
.. code-block:: php
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
@ -198,9 +200,28 @@ example we'll use an integer.
|
|||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.. 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):
|
||||||
|
|
||||||
|
.. configuration-block::
|
||||||
|
|
||||||
.. code-block:: php
|
.. code-block:: php
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
@ -212,6 +233,23 @@ timestamp or datetime):
|
|||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.. 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
|
||||||
environment, unlike timestamps where this is a possibility,
|
environment, unlike timestamps where this is a possibility,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user