Clarify not to use prefix blacklash in targetEntity
This commit is contained in:
parent
3182f150c1
commit
833a4a9319
@ -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:
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user