4

This is a general question about the magento 2 cli, and what the setup does. Every time i want to install or uninstall a module I have to run the following command.

setup:di:compile

What does this do? Does it take all the new modules and compile them? And what is the difference between this and:

setup:di:compile-multi-tenant
3

3 Answers 3

2
setup:di:compile-multi-tenant

Use this command if you have multiple tenants, which means more than one independent Magento application. In other words:

There is one Magento 2 code base instance

There is one database instance per tenant

Independent configurations in the Magento Admin per tenant

The storefronts are independent of each other

Source: http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-compiler.html

2

Command setup:di:compile is related to Magento 2's code compiler. M2 compiles code such as Factories, Interceptors, Proxies etc and puts them in var/generation directory.

One of the reasons of code generation is performance so code is readily available for application at run time and doesn't go through process of executing interceptors etc each time a request is made.

When you uninstall a plugin it may have generated code in var/generation directory, setup:di:compile will generate new version of code so uninstalled plugin code is removed.

setup:di:compile-multi-tenant

command is used when you're using more than one independent applications under one Magento 2 code base instance.

0
setup:di:compile

This command do following things

Application code generation (factories, proxies, and so on)
Area configuration aggregation (that is, optimized dependency injection configurations per area)
Interceptor generation (that is, optimized code generation of interceptors)
Interception cache generation
Repositories code generation (that is, generated code for APIs)
Service data attributes generation (that is, generated extension classes for data objects)

and setup:di:compile-multi-tenant its used for following perpose

In Magento versions 2.0.5 and earlier, there is a known issue with the single-tenant compiler; it does not currently compile proxies. Therefore, if you're preparing to deploy to production, you must use the multi-tenant compiler.

The issue was resolved in Magento versions 2.0.6 and later.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.