From 833a4a93191597017f43b0924ea07226d71efca1 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Fri, 29 Oct 2010 14:12:29 +0200 Subject: [PATCH] Clarify not to use prefix blacklash in targetEntity --- manual/en/annotations-reference.txt | 8 ++++---- manual/en/association-mapping.txt | 8 +++++++- manual/en/xml-mapping.txt | 10 +++++----- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/manual/en/annotations-reference.txt b/manual/en/annotations-reference.txt index 37b035c0e..7b162a77c 100644 --- a/manual/en/annotations-reference.txt +++ b/manual/en/annotations-reference.txt @@ -339,7 +339,7 @@ Defines that the annotated instance variable holds a reference that describes a Required attributes: -* targetEntity - FQCN of the referenced target entity. Can be the unqualified class name if both classes are in the same namespace. +* targetEntity - FQCN of the referenced target entity. Can be the unqualified class name if both classes are in the same namespace. *IMPORTANT:* No leading backslash! Optional attributes: @@ -364,7 +364,7 @@ and names of the two related entities. Required attributes: -* targetEntity - FQCN of the referenced target entity. Can be the unqualified class name if both classes are in the same namespace. +* targetEntity - FQCN of the referenced target entity. Can be the unqualified class name if both classes are in the same namespace. *IMPORTANT:* No leading backslash! Optional attributes: @@ -418,7 +418,7 @@ apply here too. Required attributes: -* targetEntity - FQCN of the referenced target entity. Can be the unqualified class name if both classes are in the same namespace. +* targetEntity - FQCN of the referenced target entity. Can be the unqualified class name if both classes are in the same namespace. *IMPORTANT:* No leading backslash! Optional attributes: @@ -442,7 +442,7 @@ Example: Required attributes: -* targetEntity - FQCN of the referenced target entity. Can be the unqualified class name if both classes are in the same namespace. +* targetEntity - FQCN of the referenced target entity. Can be the unqualified class name if both classes are in the same namespace. *IMPORTANT:* No leading backslash! Optional attributes: diff --git a/manual/en/association-mapping.txt b/manual/en/association-mapping.txt index 52ba3200f..7e35e4566 100644 --- a/manual/en/association-mapping.txt +++ b/manual/en/association-mapping.txt @@ -161,7 +161,7 @@ Now the following code will be working even if the Entity hasn't been associated $user = new User(); $user->getGroups()->add($group); -++ Association Runtime vs Development Validation +++ Runtime vs Development Mapping Validation For performance reasons Doctrine 2 has to skip some of the necessary validation of association mappings. You have to execute this validation in your development workflow to verify the associations are correctly @@ -185,6 +185,12 @@ Or you can trigger the validation manually: If the mapping is invalid the errors array contains a positive number of elements with error messages. +> **NOTE** +> +> One common error is to use a backlash in front of the fully-qualified class-name. Whenever a FQCN is represented +> inside a string (such as in your mapping definitions) you have to drop the prefix backslash. PHP does this with +> `get_class()` or Reflection methods for backwards compatibility reasons. + ++ One-To-One, Unidirectional A unidirectional one-to-one association is very common. Here is an example of a `Product` that has one `Shipping` object associated to it. The `Shipping` side does not reference back to the `Product` so it is unidirectional. diff --git a/manual/en/xml-mapping.txt b/manual/en/xml-mapping.txt index 0ebdd863f..086484406 100644 --- a/manual/en/xml-mapping.txt +++ b/manual/en/xml-mapping.txt @@ -305,7 +305,7 @@ For the inverse side the mapping is as simple as: Required attributes for inverse One-To-One: * field - Name of the property/field on the entity's PHP class. -* target-entity - Name of the entity associated entity class. If this is not qualified the namespace of the current class is prepended. +* target-entity - Name of the entity associated entity class. If this is not qualified the namespace of the current class is prepended. *IMPORTANT:* No leading backslash! * mapped-by - Name of the field on the owning side (here Address entity) that contains the owning side association. For the owning side this mapping would look like: @@ -318,7 +318,7 @@ For the owning side this mapping would look like: Required attributes for owning One-to-One: * field - Name of the property/field on the entity's PHP class. -* target-entity - Name of the entity associated entity class. If this is not qualified the namespace of the current class is prepended. +* target-entity - Name of the entity associated entity class. If this is not qualified the namespace of the current class is prepended. *IMPORTANT:* No leading backslash! Optional attributes for owning One-to-One: @@ -353,7 +353,7 @@ compared to the one-to-one case. The minimal mapping for this association looks Required attributes: * field - Name of the property/field on the entity's PHP class. -* target-entity - Name of the entity associated entity class. If this is not qualified the namespace of the current class is prepended. +* target-entity - Name of the entity associated entity class. If this is not qualified the namespace of the current class is prepended. *IMPORTANT:* No leading backslash! Optional attributes: @@ -388,7 +388,7 @@ uni-directional one-to-many association, which means this association only ever Required attributes: * field - Name of the property/field on the entity's PHP class. -* target-entity - Name of the entity associated entity class. If this is not qualified the namespace of the current class is prepended. +* target-entity - Name of the entity associated entity class. If this is not qualified the namespace of the current class is prepended. *IMPORTANT:* No leading backslash! * mapped-by - Name of the field on the owning side (here Phonenumber entity) that contains the owning side association. Optional attributes: @@ -408,7 +408,7 @@ you can omit many definitions and rely on their implicit values. Required attributes: * field - Name of the property/field on the entity's PHP class. -* target-entity - Name of the entity associated entity class. If this is not qualified the namespace of the current class is prepended. +* target-entity - Name of the entity associated entity class. If this is not qualified the namespace of the current class is prepended. *IMPORTANT:* No leading backslash! Optional attributes: