diff --git a/docs/en/tutorials/embeddables.rst b/docs/en/tutorials/embeddables.rst index 4c95016f6..cf13fd56e 100644 --- a/docs/en/tutorials/embeddables.rst +++ b/docs/en/tutorials/embeddables.rst @@ -77,9 +77,16 @@ just as if you had declared them directly there. 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:: @@ -87,33 +94,36 @@ You can change this behaviour in the following ways: + + - /** @Entity */ - class User - { - /** @Embedded(class = "Address", columnPrefix = "prefix_") */ - private $address; - } + .. code-block:: yaml - // Will NOT prefix your columns - // Your columns will be named as: - // "street", "postalCode" ... + User: + type: entity + 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 + + - - - - - - - - - - - - - - - .. 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: type: entity embedded: