50 votes

Less files in custom modules

You need to upgrade the source to include the @import command in the style-l.less file with:- php bin/magento setup:upgrade Then you need to deploy static content to compile your less files with:- ...
user avatar
21 votes
Accepted

What Triggers the Generation of a Factory in Magento 2

Some interesting code location for how this all works together: https://github.com/magento/magento2/blob/develop/dev/tests/integration/testsuite/Magento/Framework/Code/GeneratorTest.php#L40 With the ...
user avatar
11 votes
Accepted

Magento 2: Why di compile is not 100%?

As per my understanding. The whole process of setup:di:compile is divided into the 7(100%) sub code generations process. Proxies(1/7) Repositories(2/7) Service(3/7) Application(4/7) ...
user avatar
  • 9,620
10 votes

What Triggers the Generation of a Factory in Magento 2

I am digging in this same pea soup right now. My understanding so far is that all of the stuff that gets auto generated at /var/generation is done from the preferences and interfaces declared in app/...
user avatar
  • 672
10 votes
Accepted

Magento 2 - What is file Interceptor.php?

Magento 2 plugin system based on the Interceptor pattern. Calls to almost any module can be intercepted and altered. Vast improvement over the rewrite pattern in Magento 1, so obviously - no more ...
user avatar
  • 2,869
9 votes

What Triggers the Generation of a Factory in Magento 2

I haven't found in the code, the conditions for which the factories are generated, but from my understanding a factory class is generated when it is requested and not found. There are some reserved ...
user avatar
  • 196k
8 votes
Accepted

Magento 2 - I would like to understand the mechanism of running the "setup:di:compile" command

Overview of code compilation Code compilation consists of all of the following in no particular order: Application code generation (factories, proxies, and so on) Area configuration aggregation (...
user avatar
  • 2,869
8 votes
Accepted

Magento 2: Error during compilation Incompatible argument type

This is because your parent constructor has redundant arguments or not correct . In your case, need to remove arguments: $storeManager and $metadataPool. app\code\Custom\Module\Model\ResourceModel\...
user avatar
6 votes

Magento 2 : Compiler gives Class Not Found error

actually, this class really does not exist: https://github.com/magento/magento2/tree/develop/lib/internal/Magento/Framework/App/Action I think you should contact the Module Vendor. The class ...
user avatar
6 votes

magento2 what exactly purpose of Factory class?

In general you use factories to instantiate non-injectable objects, like the cms page object. Some objects require user input to instantiate so you cannot inject them via the constructor. \Magento\...
user avatar
5 votes

Less files in custom modules

I searched all Magento modules for .less files, and found none, which suggests to me that LESS is reserved to themes, and not modules. You CAN write CSS for your module, however. I found an example ...
user avatar
  • 3,242
5 votes
Accepted

Magento 2: Error during compilation

Try with below code, Remove var folder and run command of compile, class BuyingListIndex extends \Magento\Framework\View\Element\Template { public function __construct( \Magento\Framework\...
user avatar
5 votes
Accepted

When to run magento:setup:compile?

Yes you will need to run bin/magento setup:di:compile everytime when you added new classes with dependencies (constructor parameters) or changed dependencies of existing classes.(di.xml) Another ...
user avatar
  • 9,620
4 votes

Controller ignoring _forward when compiler is on - is that desired behaviour?

This is a bug which is related with magento compiler. I will give you a short glance of what is actually happens here. During compilation enabled, magento uses a copy of every files inside the ...
user avatar
4 votes

Magento 2: Error during compilation

That's the beauty of dependency injection that you don't end up using same class multiple times :) Look at the following two classes and you will find all the functions you need vendor/magento/...
user avatar
  • 561
4 votes

OptionInterfacePersistor error when compiling magento in production mode

The workaround for now is to use composer 1.2.4 and avoid using composer 1.3.x. I have done some tests to verify my comment from 27 January. In comparison with composer 1.2.4, the Magento 2.0.10 ...
user avatar
3 votes
Accepted

Magento compiler broken. Compiler doesnt work even via SSH

Somehow the folder lib/varien was not present. Copied it from a fresh Magento installation and everything worked.
user avatar
3 votes
Accepted

What are the Differences between these runcompilation,cache management and index management?

Compilation takes all the classes and files required and puts them in one directory for quicker lookup when going through the code. Indexing places data from quite few database tables in one or two ...
user avatar
3 votes

Less files in custom modules

You can add it by giving the naming as "_module.less" at below path, Magento will include it by default and you don't need to code anywhere to call it: view/frontend/web/css/source/_module....
user avatar
3 votes
Accepted

setup:di:compile in the different modes

If you don't run setup:di:compile or clean var/di, DI will work same in all mode. If you run setup:di:compile and enable production mode, DI will get information from compiled files from var/di.
user avatar
  • 20.3k
3 votes
Accepted

Magento 2 compile less files on staging server

Grunt is a Node Js package, to make the Grunt commands can work, we need to install Node Js on your Staging Server. However, this way doesn't recommend. We can deploy static content in both ways: ...
user avatar
3 votes

Zend_Db_Adapter_Exception pdo_mysql extension is not installed

To install the missing pdo-mysql extension in Ubuntu, run sudo apt-get install pdo-mysql php7.0-mysql or if you run PHP 5 sudo apt-get install pdo-mysql php5-mysql
user avatar
3 votes
Accepted

Magento2 change to production mode

you can follow below steps go to app/etc/env.php file Set MAGE_MODE' => 'production' Run below commands bin/magento setup:static-content:deploy bin/magento setup:di:compile
user avatar
2 votes

Magento Compiler and Backup issues

Addendum to @Sander Mangel's answer as to why they may have been forcibly disabled: If you inherited the management of this website, the compiler is probably shut off for a good reason, the previous ...
user avatar
  • 7,573
2 votes

Fatal error message

It looks like your code is loading disabled module. So, when Magento didn't find proper module by module name it'll try to load Mage_Modulename_... I'd suggest to disable compilation at first, clean ...
user avatar
  • 713
2 votes

Magento1.9 Compilation Not enabling in Admin panel

customized codes are removed from include folder Did I understand that correct and you made modifications to the compiled Magento files? Sorry to break it to you but this is wrong on several levels. ...
user avatar
2 votes

Fatal error message

The class Mage_ConfigurableSwatches_Helper_Data was implemented in Magento 1.9.1.0 It appears that some extension or theme is calling that class and it's not present in your installation (due to a ...
user avatar
2 votes

Magento Upgrade: Fatal error: Class 'Magento_Db_Adapter_Pdo_Mysql' not found in /home/xxxxx/public_html/includes/src/__default.php on line 29298

As per as your question, i have see that complier is enable at system.So you should disable the compile before upgrade.After upgrade you need enable compiler Disable compiler by command prompt php -...
user avatar
  • 75.8k
2 votes

Warning: include(File.php) failed in Autoload.php on line 93

Just encountered a weird Warning: include(somefile.php) failed in Autoload.php on line 93 after pulling work on a shared test environment and someone else enabled the cache. Not this exact case, ...
user avatar
2 votes

Magento compilation hangs!

I just fixed this exact error. I disabled all my 3rd party modules one by one and surprisingly the compile was still hanging up in the same spot. The solution to get compiling to work for me was to ...
user avatar
  • 915

Only top scored, non community-wiki answers of a minimum length are eligible