Skip to content

Commit c06dc09

Browse files
author
bohar
committed
[TemplateDescription] #87 - Added description for dependency injection preference template
1 parent 0c3ff4f commit c06dc09

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<preference for="${FOR}" type="${TYPE}" />
1+
<preference for="${FOR}" type="${TYPE}" />

resources/fileTemplates/code/Magento Module DI Xml Preference.xml.html

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,34 @@
66
-->
77
<html>
88
<body>
9+
<table width="100%" border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse">
10+
<tr>
11+
<td><font face="verdana" size="-1">
12+
The object manager uses mappings to determine what the default implementation is for a class in a constructor (scope dependent).
13+
For this goal where designed preference node in the di.xml settings file.
14+
For example:
15+
In class A here are dependencies in the constructor - interface B and class C.
16+
Our aim to get in the class A concrete realization of interface B - BConcrete and replace concrete implementation for class C on its child CSpecific.
17+
We can easily determine for object manager to instantiate interface B as concrete class BConcrete by using this template.
18+
In the same way, we can determine for object manager to instantiate class CSpecific instead of class C.
19+
</font><br>
20+
</td>
21+
</tr>
22+
</table>
23+
<table width="100%" border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse">
24+
<tr>
25+
<td colspan="3"><font face="verdana" size="-1">Predefined variables will take the following values:</font></td>
26+
</tr>
27+
<tr>
28+
<td valign="top"><nobr><font face="verdana" size="-2"><b>${FOR}</b></font></nobr></td>
29+
<td width="10">&nbsp;</td>
30+
<td width="100%" valign="top"><font face="verdana" size="-1">Target PHP Class to change its concrete implementation</font></td>
31+
</tr>
32+
<tr>
33+
<td valign="top"><nobr><font face="verdana" size="-2"><b>${TYPE}</b></font></nobr></td>
34+
<td width="10">&nbsp;</td>
35+
<td width="100%" valign="top"><font face="verdana" size="-1">PHP Class that will be instantiated instead of specified in predefined ${FOR} variable</font></td>
36+
</tr>
37+
</table>
938
</body>
10-
</html>
39+
</html>

0 commit comments

Comments
 (0)