Make embeddable doc more succinct, fix xml
This commit is contained in:
parent
3bd916f763
commit
857fed0310
@ -77,9 +77,16 @@ just as if you had declared them directly there.
|
|||||||
Column Prefixing
|
Column Prefixing
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
By default, Doctrine prefixes your columns by using the value object name.
|
By default, Doctrine names your columns by prefixing them, using the value
|
||||||
|
object name.
|
||||||
|
|
||||||
You can change this behaviour in the following ways:
|
Following the example above, your columns would be named as ``address_street``,
|
||||||
|
``address_postalCode``...
|
||||||
|
|
||||||
|
You can change this behaviour to meet your needs by changing the
|
||||||
|
``columnPrefix`` attribute in the ``@Embeddable`` notation.
|
||||||
|
|
||||||
|
The following example shows you how to set your prefix to ``myPrefix_``:
|
||||||
|
|
||||||
.. configuration-block::
|
.. configuration-block::
|
||||||
|
|
||||||
@ -87,33 +94,36 @@ You can change this behaviour in the following ways:
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Default behaviour
|
|
||||||
// Will name your columns by prefixing them with "address_"
|
|
||||||
// Your columns will be named as:
|
|
||||||
// "address_street", "address_postalCode" ...
|
|
||||||
|
|
||||||
/** @Entity */
|
/** @Entity */
|
||||||
class User
|
class User
|
||||||
{
|
{
|
||||||
/** @Embedded(class = "Address") */
|
/** @Embedded(class = "Address", columnPrefix = "myPrefix_") */
|
||||||
private $address;
|
private $address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.. code-block:: xml
|
||||||
|
|
||||||
// Will name your columns by prefixing them with "prefix_"
|
<entity name="User">
|
||||||
// Your columns will be named as:
|
<embedded name="address" class="Address" column-prefix="myPrefix_" />
|
||||||
// "prefix_street", "prefix_postalCode" ...
|
</entity>
|
||||||
|
|
||||||
/** @Entity */
|
.. code-block:: yaml
|
||||||
class User
|
|
||||||
{
|
|
||||||
/** @Embedded(class = "Address", columnPrefix = "prefix_") */
|
|
||||||
private $address;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Will NOT prefix your columns
|
User:
|
||||||
// Your columns will be named as:
|
type: entity
|
||||||
// "street", "postalCode" ...
|
embedded:
|
||||||
|
address:
|
||||||
|
class: Address
|
||||||
|
columnPrefix: myPrefix_
|
||||||
|
|
||||||
|
To have Doctrine drop the prefix and use the value object's property name
|
||||||
|
directly, set ``columnPrefix=false`` (not yet supported with XML configuration):
|
||||||
|
|
||||||
|
.. configuration-block::
|
||||||
|
|
||||||
|
.. code-block:: php
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
/** @Entity */
|
/** @Entity */
|
||||||
class User
|
class User
|
||||||
@ -122,43 +132,8 @@ You can change this behaviour in the following ways:
|
|||||||
private $address;
|
private $address;
|
||||||
}
|
}
|
||||||
|
|
||||||
.. code-block:: xml
|
|
||||||
|
|
||||||
<!-- Default behaviour -->
|
|
||||||
<!-- Will name your columns by prefixing them with "address_" -->
|
|
||||||
<entity name="User">
|
|
||||||
<embedded name="address" class="Address" />
|
|
||||||
</entity>
|
|
||||||
|
|
||||||
<!-- Will name your columns by prefixing them with "prefix_" -->
|
|
||||||
<entity name="User">
|
|
||||||
<embedded name="address" class="Address" columnPrefix="prefix_" />
|
|
||||||
</entity>
|
|
||||||
|
|
||||||
<!-- Will NOT prefix your columns -->
|
|
||||||
<entity name="User">
|
|
||||||
<embedded name="address" class="Address" columnPrefix="false" />
|
|
||||||
</entity>
|
|
||||||
|
|
||||||
.. code-block:: yaml
|
.. code-block:: yaml
|
||||||
|
|
||||||
# Default behaviour
|
|
||||||
# Will name your columns by prefixing them with "address_"
|
|
||||||
User:
|
|
||||||
type: entity
|
|
||||||
embedded:
|
|
||||||
address:
|
|
||||||
class: Address
|
|
||||||
|
|
||||||
# Will name your columns by prefixing them with "prefix_"
|
|
||||||
User:
|
|
||||||
type: entity
|
|
||||||
embedded:
|
|
||||||
address:
|
|
||||||
class: Address
|
|
||||||
columnPrefix: prefix_
|
|
||||||
|
|
||||||
# Will NOT prefix your columns
|
|
||||||
User:
|
User:
|
||||||
type: entity
|
type: entity
|
||||||
embedded:
|
embedded:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user