Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb06dac7

Browse files
committed
Modernise resolve_target_entities documentation
1 parent47f81eb commitb06dac7

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

‎doctrine/resolve_target_entity.rst

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
How to Define Relationships with Abstract Classes and Interfaces
2-
================================================================
1+
Referencing Entities with Abstract Classes and Interfaces
2+
=========================================================
33

4-
One of the goals of bundlesisto create discrete bundles of functionality
5-
that do not have many (if any) dependencies, allowing you to use that
6-
functionality in other applications without including unnecessary items.
4+
In applications where functionalityissegregated with minimal concrete dependencies
5+
between the various layers, such as monoliths which are split into multiple modules,
6+
it might be hard to prevent hard dependencies on entities between modules.
77

88
Doctrine 2.2 includes a new utility called the ``ResolveTargetEntityListener``,
99
that functions by intercepting certain calls inside Doctrine and rewriting
1010
``targetEntity`` parameters in your metadata mapping at runtime. It means that
11-
in your bundleyou are able to use an interface or abstract class in your
12-
mappings and expectcorrect mapping to a concrete entity at runtime.
11+
you are able to use an interface or abstract class in your mappings and expect
12+
correct mapping to a concrete entity at runtime.
1313

1414
This functionality allows you to define relationships between different entities
1515
without making them hard dependencies.
@@ -22,14 +22,14 @@ without making them hard dependencies.
2222
Background
2323
----------
2424

25-
Suppose you have anInvoiceBundle which providesinvoicing functionality
26-
and aCustomerBundlethat contains customer management tools. You want
27-
to keep these separated, because theycan be used in other systems without
28-
each other, but for your application you want to use them together.
25+
Suppose you have anapplication which providestwo modules; an Invoice module which
26+
provides invoicing functionality,and aCustomer modulethat contains customer management
27+
tools. You wantto keepdependencies betweenthesemodulesseparated, because theyshould
28+
not be aware of the other module's implementation details.
2929

30-
In this case, you have an ``Invoice`` entity with a relationship toa
31-
non-existent object, an``InvoiceSubjectInterface``.The goalisto get
32-
the ``ResolveTargetEntityListener`` to replace any mention of the interface
30+
In this case, you have an ``Invoice`` entity with a relationship tothe interface
31+
``InvoiceSubjectInterface``.Thisisnot recognized as a valid entity by Doctrine.
32+
The goal is to getthe ``ResolveTargetEntityListener`` to replace any mention of the interface
3333
with a real object that implements that interface.
3434

3535
Set up
@@ -94,7 +94,7 @@ An InvoiceSubjectInterface::
9494
public function getName(): string;
9595
}
9696

97-
Next, you need to configure thelistener, which tells the DoctrineBundle
97+
Next, you need to configure the``resolve_target_entities`` option, which tells the DoctrineBundle
9898
about the replacement:
9999

100100
..configuration-block::
@@ -146,6 +146,6 @@ Final Thoughts
146146
--------------
147147

148148
With the ``ResolveTargetEntityListener``, you are able to decouple your
149-
bundles, keeping them usable by themselves, but still being able to
149+
modules, keeping them usable by themselves, but still being able to
150150
define relationships between different objects. By using this method,
151-
yourbundles will end up being easier to maintain independently.
151+
yourmodules will end up being easier to maintain independently.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp