Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 26dd055

Browse files
authored
Merge pull request magento#4803 from magento/ds_rm-2.1-symlinks
Replacing symlinks to 2.1 documentation with real files
2 parents e7ad758 + 2946d41 commit 26dd055

File tree

1,207 files changed

+127776
-1197
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,207 files changed

+127776
-1197
lines changed

guides/v2.2/architecture/archi_perspectives/ABasics_intro.md

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
group: architecture-guide
3+
title: Architectural basics overview
4+
menu_title: Architectural basics
5+
---
6+
7+
Magento incorporates the core architectural principles of object-oriented, PHP-based applications. Comprehensive discussions of these general principles exist both on-line and in printed form.
8+
9+
The following discussion focuses on how these topics apply directly to Magento:
10+
11+
* Magento technology stack
12+
* Magento View Model
13+
* Extensibility
14+
* Modularity
15+
* Event-driven architecture
16+
* Security
17+
18+
## Related topics
19+
20+
[Architectural diagrams]({{page.baseurl}}/architecture/archi_perspectives/arch_diagrams.html)
21+
22+
[Technology stack]({{page.baseurl}}/architecture/tech-stack.html)
23+
24+
[Stack basics]({{page.baseurl}}/architecture/tech-stack.html)
25+
26+
[Versioning]({{page.baseurl}}/extension-dev-guide/versioning/)

guides/v2.2/architecture/archi_perspectives/ALayers_intro.md

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
group: architecture-guide
3+
title: Architectural layers overview
4+
menu_title: Architectural layers
5+
---
6+
7+
## Magento as layered software
8+
9+
At its highest level, Magento's product architecture consists of the core product code plus optional *modules*. These optional modules enhance or replace the basic product code.
10+
11+
If you are substantially customizing the basic Magento product, [module](https://glossary.magento.com/module) development will be your central focus. Modules organize code that supports a particular task or feature. A module can include code to change the look-and-feel of your [storefront](https://glossary.magento.com/storefront) as well as its fundamental behavior.
12+
13+
Your modules function with the core Magento product code, which is organized into layers. Understanding layered software pattern is essential for understanding basic Magento product organization.
14+
15+
Layered software is a popular, widely discussed principle in software development. Many resources exist for this topic, but consider consulting Pattern-Oriented Software Architecture for a general discussion.
16+
17+
## Advantages of layered application design
18+
19+
Layered application design offers many advantages, but users of Magento will appreciate:
20+
21+
* Stringent separation of business logic from presentation logic simplifies the customization process. For example, you can alter your storefront appearance without affecting any of the [backend](https://glossary.magento.com/backend) business logic.
22+
23+
* Clear organization of code predictably points [extension](https://glossary.magento.com/extension) developers to code location.
24+
25+
## Related topics
26+
27+
[Architectural diagrams]({{page.baseurl}}/architecture/archi_perspectives/arch_diagrams.html)
28+
29+
[Presentation layer]({{page.baseurl}}/architecture/archi_perspectives/present_layer.html)
30+
31+
[Service layer]({{page.baseurl}}/architecture/archi_perspectives/service_layer.html)
32+
33+
[Domain layer]({{page.baseurl}}/architecture/archi_perspectives/domain_layer.html)
34+
35+
[Persistence layer]({{page.baseurl}}/architecture/archi_perspectives/persist_layer.html)

guides/v2.2/architecture/archi_perspectives/arch_diagrams.md

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
group: architecture-guide
3+
title: Architectural diagrams
4+
menu_title: Architectural diagrams
5+
---
6+
7+
## Magento architecture from different perspectives {#m2arch-whatis-overview}
8+
9+
Depending upon your role and purpose for learning more about Magento, there are several different ways to view the Magento architecture. For example, a developer who wants to create new modules or perhaps customize an existing [module](https://glossary.magento.com/module) will want to understand the architecture of a module itself, and how it fits into the larger view, with the Magento framework and other components. However, a merchant who wants to quickly build an online storefront wants to view the collection of components from a higher level, and understand the components that impact the look, feel, and user interaction components.
10+
11+
## Architecture layers diagram {#archi-layers}
12+
13+
The following diagram illustrates the components and shows the "layers" or tiers in Magento.
14+
15+
![]({{site.baseurl}}/common/images/archi_diagrams_current.png)
16+
17+
## Related topics
18+
19+
* [Architecture layers overview]({{page.baseurl}}/architecture/archi_perspectives/ALayers_intro.html)

guides/v2.2/architecture/archi_perspectives/components/AComponents.md

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
group: architecture-guide
3+
title: Magento Components
4+
menu_title: Components
5+
---
6+
7+
## Magento components
8+
9+
Magento has several core components that are used to build custom websites, applications, and integrated systems. When you change the appearance or behavior of your Magento store, you are inevitably changing one or more of these **core Magento components**, which include **modules**, **themes**, and **language packages**. Together, these core components determine much of server-side and [storefront](https://glossary.magento.com/storefront) (frontend) appearance and behavior.
10+
11+
{:.bs-callout .bs-callout-tip}
12+
Throughout the Magento documentation set, we also use the term *component* in its generic sense to mean element or part. However, the term **Magento component** explicitly refers to either a module, theme, or [language package](https://glossary.magento.com/language-package).
13+
14+
For more information about individual Magento components, see:
15+
16+
* [Modules]({{page.baseurl}}/architecture/archi_perspectives/components/modules/mod_intro.html)
17+
18+
* [Themes]({{page.baseurl}}/frontend-dev-guide/themes/theme-overview.html)
19+
20+
* [Language packages]({{page.baseurl}}/frontend-dev-guide/translations/xlate.html#m2devgde-xlate-languagepack)

guides/v2.2/architecture/archi_perspectives/components/modules/mod_and_areas.md

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
group: architecture-guide
3+
title: Modules and areas
4+
menu_title: Modules and areas
5+
---
6+
7+
## Overview {#m2arch-module-areas-overview}
8+
9+
An *area* is a logical component that organizes code for optimized request processing. Magento uses areas to streamline web service calls by loading only the dependent code for the specified area. Each of the default areas defined by Magento can contain completely different code on how to process URLs and requests.
10+
11+
For example, if you are invoking a REST web service call, rather than load all the code related to generating user [HTML](https://glossary.magento.com/html) pages, you can specify a separate area that loads code whose scope is limited to answering REST calls.
12+
13+
### Magento area types
14+
15+
Magento is organized into these main areas:
16+
17+
* **Magento Admin** (`adminhtml`): entry point for this area is `index.php` or `pub/index.php`. The [Admin](https://glossary.magento.com/admin) panel area includes the code needed for store management. The /app/design/adminhtml directory contains all the code for components you'll see while working in the Admin panel.
18+
19+
* **Storefront** (`frontend`): entry point for this area is `index.php` or `pub/index.php`. The storefront (or `frontend`) contains template and [layout](https://glossary.magento.com/layout) files that define the appearance of your [storefront](https://glossary.magento.com/storefront).
20+
21+
* **Basic** (`base`): used as a fallback for files absent in `adminhtml` and `frontend` areas.
22+
23+
* **Cron** (`crontab`): In `cron.php`, the [`\Magento\Framework\App\Cron`]({{ site.mage2bloburl }}/{{ page.guide_version }}/lib/internal/Magento/Framework/App/Cron.php#L68-L70){:target="_blank"} class always loads the 'crontab' area.
24+
25+
You can also send requests to Magento using the SOAP and REST APIs. These two areas
26+
27+
* **Web API REST** (`webapi_rest`): entry point for this area is `index.php` or `pub/index.php`. The REST area has a front controller that understands how to do [URL](https://glossary.magento.com/url) lookups for REST-based URLs.
28+
29+
* **Web API SOAP** (`webapi_soap`): entry point for this area is `index.php` or `pub/index.php`.
30+
31+
## How areas work with modules {#m2arch-module-using}
32+
33+
Modules define which resources are visible and accessible in an area, as well as an area's behavior. The same [module](https://glossary.magento.com/module) can influence several areas. For instance, the RMA module is represented partly in the `adminhtml` area and partly in the `frontend` area.
34+
35+
If your [extension](https://glossary.magento.com/extension) works in several different areas, ensure it has separate behavior and view components for each area.
36+
37+
Each area declares itself within a module. All resources specific for an area are located within the same module as well.
38+
39+
You can enable or disable an area within a module. If this module is enabled, it injects an area's routers into the general application's routing process. If this module is disabled, Magento will not load an area's routers and, as a result, an area's resources and specific functionality are not available.
40+
41+
### Module/area interaction guidelines
42+
43+
* Modules should not depend on other modules' areas.
44+
45+
* Disabling an area does not result in disabling the modules related to it.
46+
47+
* Areas are registered in the [Dependency Injection](https://glossary.magento.com/dependency-injection) framework `di.xml` file.
48+
49+
### Note about Magento request processing
50+
51+
Magento processes a URL request by first stripping off the base URL. The first path segment of the remaining URL identifies the request area.
52+
53+
After the area name, the URI segment specifies the *frontname*. When an HTTP request arrives, Magento extracts the handle from the URL and interprets it as follows: `[frontName]/[controller folder]/[controller class]` where `frontName` is a value defined in the module. For example, in `catalog/product/view`, `catalog` is the name of the module used, `product` is the controller folder, and `view` is the controller class. For deeper directory structures, the controller folders are separated with `_` (for example, `catalog/product_compare/add` for `Magento/Catalog/Controller/Product/Compare/Add.php`).
54+
55+
Note that only the **execute()** method of any given controller is executed.
56+
57+
## Related topics {#m2arch-module-related}
58+
59+
[Module overview]({{page.baseurl}}/architecture/archi_perspectives/components/modules/mod_intro.html)

guides/v2.2/architecture/archi_perspectives/components/modules/mod_conventions.md

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
group: architecture-guide
3+
title: Module conventions
4+
menu_title: Module conventions
5+
---
6+
7+
## Overview {#m2arch-module-conventions-overview}
8+
9+
Modules must conform to Magento conventions regarding code location and file names. Keep these conventions in mind when working with or developing modules.
10+
11+
Be sure to research additional Magento conventions, beyond those applicable to modules. For more information, see [Coding Standards]({{page.baseurl}}/coding-standards/bk-coding-standards.html).
12+
13+
## Module location conventions {#m2arch-module-conventions-location}
14+
15+
The following table shows the *recommended* location within the Magento file system for specific components.
16+
17+
(A [module](https://glossary.magento.com/module) must include a `registration.php` file in its root folder.)
18+
19+
We refer to a component's root directory as the top-level directory in which you develop component code. Typically, this directory is located in one of the following directories relative to the Magento root directory:
20+
21+
|Entity|Location|
22+
|---|---|
23+
|Code base of your custom module|`/app/code/<Vendor>/<Module>`|
24+
|Custom theme files (storefront)|`/app/design/frontend/<Vendor>/<theme>`|
25+
|Custom theme files (modules)|`<Module>/<theme>`|
26+
|If you want to use a library|`/lib/<Vendor_Library>`|

guides/v2.2/architecture/archi_perspectives/components/modules/mod_depend.md

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
---
2+
group: architecture-guide
3+
title: Module dependencies
4+
menu_title: Module dependencies
5+
---
6+
7+
## Overview {#m2devgde-moddep-intro}
8+
9+
A *software dependency* identifies one software component's reliance on another for proper functioning. A core principle of Magento architecture is the **minimization of software dependencies**. Instead of being closely interrelated with other modules, modules are optimally designed to be *loosely coupled*. Loosely coupled modules require little or no knowledge of other modules to perform their tasks.
10+
11+
Each Magento [module](https://glossary.magento.com/module) is responsible for a unique feature. In practice, this means that:
12+
13+
* Several modules cannot be responsible for one feature.
14+
15+
* One module cannot be responsible for several features.
16+
17+
* Module dependencies on other modules must be declared explicitly. You must also declare any dependency upon other components (for example, a theme, language package, or library).
18+
19+
* Removing or disabling a module does not result in disabling other modules.
20+
21+
## Two types of dependencies {#m2devgde-moddep-declare-dep}
22+
23+
There are two types of Magento {% glossarytooltip c1e4242b-1f1a-44c3-9d72-1d5b1435e142 %}module{% endglossarytooltip %} dependencies: hard and soft.
24+
25+
### Hard dependencies
26+
27+
A module with a *hard dependency* on another module cannot function without the module it depends on. These modules:
28+
29+
* Contain code that directly uses logic from another module, such as class constants, static methods, public class properties, interfaces, and traits.
30+
* Contain strings that include class names, method names, class constants, class properties, interfaces, and traits from another module.
31+
* Deserializes an object declared in another module.
32+
* Uses or modifies the database tables used by another module.
33+
34+
### Soft dependencies
35+
36+
A module with a *soft dependency* on another module can function properly without the other module, even if it has a dependency on the other module. These modules:
37+
38+
* Directly check another module's availability.
39+
* Extend another module's configuration.
40+
* Extend another module's {% glossarytooltip 73ab5daa-5857-4039-97df-11269b626134 %}layout{% endglossarytooltip %}.
41+
42+
{:.bs-callout .bs-callout-tip}
43+
If a module uses code from another module, it should declare the dependency explicitly.
44+
45+
## Module install order
46+
47+
Magento installs modules in the following order:
48+
49+
1. The module serving as a dependency for another module
50+
2. The module dependent on it
51+
52+
## Appropriate dependencies
53+
54+
Although Magento architecture favors loosely coupled software components, modules can contain dependencies upon these software components:
55+
56+
* other modules
57+
58+
* [PHP](https://glossary.magento.com/php) extensions
59+
60+
* libraries (either Magento Framework [library](https://glossary.magento.com/library) or third party libraries)
61+
62+
{:.bs-callout .bs-callout-tip}
63+
Note: You can lose the historical information contained in a module if the module is removed or disabled. We recommend alternative storage of module information before you remove or disable a module.
64+
65+
## Inappropriate dependencies {#m2devgde-moddep-inapp-dep}
66+
67+
Avoid creating these dependencies:
68+
69+
* Circular (both direct and indirect)
70+
* Undeclared
71+
* Incorrect
72+
73+
## Dependencies between modules in different presentation layers {#m2devgde-moddep-diff-layer}
74+
75+
You can build dependencies between the modules belonging to different layers.
76+
77+
## Dependencies in the Framework layer {#m2devgde-moddep-frmwk-layer}
78+
79+
A module belonging to the Magento Framework can be used in the application layer by an explicit dependency.
80+
81+
{:.bs-callout .bs-callout-tip}
82+
In this case, using interfaces is preferable to using classes. You can build dependencies between classes in the Magento Framework even if they belong to different modules.
83+
84+
## Dependencies in the application layer {#m2devgde-moddep-app-layer}
85+
86+
A module belonging to the application layer cannot be used in the Magento Framework.
87+
88+
You can build dependencies between classes in the application layer, but these classes must belong to the same module. Dependencies between the modules of the application layer should be built only by the {% glossarytooltip cdf644c4-bc99-4550-a954-dd5ae165785a %}service contract{% endglossarytooltip %} or the service provider interface (SPI).
89+
90+
## Managing module dependencies
91+
92+
At a high level, there are three main steps for managing module dependencies:
93+
94+
1. Name and declare the module in the `module.xml` file.
95+
96+
2. Declare any dependencies that the module has (whether on other modules or on a different component) in the module's `composer.json` file.
97+
98+
3. (*Optional*) Define the desired load order of config files and `.css` files in the `module.xml` file.
99+
100+
Example: Module A declares a dependency upon Module B. Thus, in Module A's `module.xml` file, Module B is listed in the `<sequence>` list, so that B's files are loaded before A's. Additionally, you must declare a dependency upon Module B in A's `composer.json` file. Furthermore, in the [deployment configuration]({{page.baseurl}}/config-guide/config/config-php.html), Modules A and B must both be defined as enabled.
101+
102+
`etc/module.xml`
103+
104+
```xml
105+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
106+
<module name="Module_A" setup_version="1.0.0">
107+
<sequence>
108+
<module name="Module_B" />
109+
</sequence>
110+
</module>
111+
</config>
112+
```
113+
114+
After installing the module and opening `app/etc/config.php`, you are able to see that the Module_B was loaded before Module_A:
115+
116+
```php
117+
return [
118+
'modules' => [
119+
...
120+
'Module_B' => 1,
121+
'Module_A' => 1,
122+
...
123+
]
124+
];
125+
```
126+
127+
## Related topics {#m2arch-module-related}
128+
129+
[Module overview]({{page.baseurl}}/architecture/archi_perspectives/components/modules/mod_intro.html)

guides/v2.2/architecture/archi_perspectives/components/modules/mod_depend_types.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)