44

[DISCLAIMER] This answer is only meant for the compiler in Magento 1, the compiler in Magento 2 has a complete different purpose/effect You should use it never. Because PHP has developed several mechanics to improve applications containing lots of files. Means: the php opCache in current php version gives way better performance improvements, if correctly ...


37

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:- php bin/magento setup:static-content:deploy Also by convention the file should be named:- code/Vendor/module/view/frontend/web/css/source/_module.less


21

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 different types coming mostly from here https://github.com/magento/magento2/tree/develop/lib/internal/Magento/Framework/ObjectManager/Code/Generator but also ...


20

Flush Magento Cache - This clears the cache (var/cache) of any items that Magento knows it has created. Flush Cache Storage - Clears everything in var/cache, regardless of how those files in there were created. So, if you want to be safe you're clearing everything, you may choose "Flush Cache Storage" which will essentially clear out var/cache. For the ...


15

Magento cache is no different. Starting off with the basics, cache options can be viewed by navigating to System->Cache Management in the backend. You can see the different areas of caching that can be enabled/disabled, such as any configurations, layout.xml, blocks, full page, and api files. Obviously the ideal is to have all of these enabled once the ...


12

"When should I use the Magento Compiler" If for some reason your system does not have a PHP Accelerator installed ( unlikely but possible ) If your running a very old version of magento ( you really shouldn't be ) Why should you keep it disabled ? I totaly agree with Fiasco Labs comment above. While you didn't give your magento version number, this is ...


11

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) Interceptors(5/7) Area Configuration(6/7) Interception(7/7) Each process shows its Compilation part(ex - 1/7) and its percentage(ex - 10%/100%). When single process end ,...


10

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 rewrite conflict! For example: DI.xml <config> <type name="{ObservedType}"> <plugin name="{pluginName}" type="{PluginClassName}" ...


9

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/etc/di.xml. Interfaces and preferences of yours are going to be declared in the di.xml file in your /app/code/Vendor/<module>/etc/di.xml. It knows to ...


9

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 keywords Factory, Proxy, Interceptor, if used, will trigger code generation when the specific classes are not found. I will post back as soon as I find the code ...


8

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 (that is, optimized dependency injection configurations per area) Interceptor generation (that is, optimized code generation of interceptors) Interception cache ...


7

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\Posts\Grid\Collection.php parent::__construct( $entityFactory, $logger, $fetchStrategy, $eventManager, //$storeManager, &...


6

the Autoload tries to require the file for a class that isn't found in the code base yet. Since it is requiring File.php it stands to reason that somewhere in the code the class File() is called which doesn't exist yet in your codebase. If you track down the spot where that class is instantiated you will have fixed the issue.


6

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 required most likely should be Magento\Framework\App\Action\Context ===UPDATE=== you should also be able to run the command with verbose output according to the ...


6

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\Catalog\Model\ResourceModel\Category\Collection is not one of those cases. Factories are usually auto-generated, in the sense that, if you don't define one ...


5

The only way that I think is possible to consistently avoid this is to turn off compilation mode before installing / making any code changes. You will also need to rerun the compilation process after the installation. Simply re-enabling it will have the same issue. The underlying problem is that with compilation mode enabled Magento parses the new config....


5

For follow-up, the mageDebugBacktrace() provided the following result: [1] : [2] : [3] /var/public_html/domain.com/live/app/code/core/Mage/Core/Model/Cache.php:199 [4] /var/public_html/domain.com/live/app/code/core/Mage/Core/Model/Cache.php:119 [5] /var/public_html/domain.com/live/app/code/core/Mage/Core/Model/Config.php:1348 [6] /var/public_html/domain.com/...


5

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 in module-swatches. view/frontend/css/swatches.css Then view/frontend/layout/catalog_category_view.xml <head> <css src="Magento_Swatches::css/...


5

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\View\Element\Template\Context $context, \Custom\Module\Model\ResourceModel\Posts\CollectionFactory $collectionFactory, \Custom\Module\Model\Posts $posts, ...


5

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 main thing here is Code compilation. setup:di:compile command compiles your code everytime. its compile the code and check is there any error in that code or ...


4

You'll need to re-run the compiler via System > Tools > Compilation.


4

Not the same thing, and yes you can use them at the same time. APC stores compiled versions (as in compiled into op-code) of php scripts, thus saving time for the interpreter to compile each script first before it can be run. Magento's compile (as you already stated) is just concatenation. It would still need to be compiled to op-code when it is run. The ...


4

Magento doesn't clear the caches when enabling compiling. If you dont clear the caches Magento will still remember where the files should be, but that conflicts with the compiled version. So clear all the caches (magento, apc, memcached, what else you got) should fix this problem.


4

Edit: Yoav Kutner (Magento CTO) let me know that “in later versions since we optimized the catalog EAV, Magento Compilation is not really needed if you have byte code caching and if it is configured correctly“. Source: http://www.gxjansen.com/101-ways-to-speed-up-your-magento-e-commerce-website/ Simply enabling Compilation you won't notice much if ...


4

Compiler is very stable and only really encounters problems with edge cases where there is a relative class include hardcoded (rather than reliant on the Magento autoloader). These are few and far between though. There are several advantages to compiler, the main reason being its benefits in an IO constrained environment. Your mileage will vary as to what ...


4

I can't answer the question, but I think I can answer another one: Should I use the compiler HELL NO. There is not advantage of the compiler, only a lot of problems. No speed performance and debugging is hell If you want more performance, update PHP to 5.5


4

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 directory include/src. Since every file have a corresponding copy in single directory and magento uses this single directory while coimpilation enabled, magento ...


4

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 code has these changed files when installed with composer 1.3.0: modified: composer.lock modified: vendor/composer/ClassLoader.php modified: vendor/...


3

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 tables (per indexer) most of the times applying further logic to the data before putting it in the database tables for quicker database lookups and processing. ...


3

COMPILER All compiler files can be found in includes/ Just don't wipe .htaccess or config.php. If you view config.php You'll notice all enabling/disabling compiler does is removing the comments # before the two define. It's safe to assume a simple rm -Rf includes/src;rm -Rf includes/stat from the Magento root will wipe the compiled data. Also consider ...


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