Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [code-generation]

The tag has no usage guidance.

0
votes
2answers
43 views

During setup:di:compile getting error:- Source class “\PHPExcel_IO” for “PHPExcel_IOFactory” generation does not exist

When i'm running "setup:di:compile" or setting mode to "production" from "default" then getting following error:- Please help me to resolve this problem immediately. ------Update@Start--------------...
0
votes
0answers
32 views

Magento Cloud: error in admin on copying custom options

Getting this error in admin pannel of Magento Cloud instance when copying custom option of one product to another via action. I Think It seems as some permission of generated and cache folders. Any ...
0
votes
0answers
22 views

Error Class not found before deleting generated folder

I have created a preference to override a class but constantly getting error "Class not found" before deleting "generated" folder content: Error: Fatal error: Uncaught Error: Class 'Vendor\Module\...
0
votes
0answers
127 views

Can I delete generated folder after compilation in magento 2?

I have faced error in production mode while click on custom menu in admin.in developer mode every thing working fine. Fatal error: Uncaught Error: Call to a member function setActive() on boolean ...
2
votes
1answer
153 views

Scaling Magento 2 on multiple containers in production with generated code

I'm working on some auto-scaling Kubernetes infrastructure to run Magento 2, and I noticed that when I start new containers, I can't have the generated/ directory automatically compiled as part of the ...
3
votes
1answer
78 views

Explanation about a code generation in Magento 2?

I want to know : The purpose of code generation in Magento 2 ? How it works, (how Magento generate that code) ? I know basic code generation
0
votes
1answer
108 views

Debugging “Invalid return type” in generated code?

Is there a way to track down this error report? stdClass Object ( [0] => Invalid return type [1] => #0 /home/maxxcou1/public_html/mag2/generated/code/Magento/Framework/App/Http/...
1
vote
1answer
42 views

Magento 2 : var/Generation Magento Tutorial

Can you Suggest any tutorial for var/generation and Patterns in Magento 2. Please Provide video Related materials. Thanks
0
votes
2answers
66 views

Why is Magento 2 creating this Interceptor file?

I've been comparing two versions of a website I'm working on -- one is fine and the other has a broken layout -- and the main difference I've found between them is the following file: generated/code/...
0
votes
2answers
4k views

Blank screen after compiling

After putting the site into production mode and running the compiler, the site just loads a blank white page. I've tried disabling all third party modules and it has not helped. I have all error ...
1
vote
0answers
128 views

Generation of Extension interfaces

What is the code that generates the ExtensionInterface suffixed classes ? For example, there is this file that declares extension attribute on the product options (and others). Magento/Catalog/etc/...
2
votes
1answer
391 views

When I am deleting files from var folder It is giving error

I have installed two Magento's at my live server of version 2.1.7 & 2.1.8 When I am deleting some files from /Var folder it is giving me error in my system like bellow In CMD [Exception] ...
1
vote
1answer
67 views

Magento 2 some functions' definition does not exist

I use Magento 2.1.9, I came across these 2 that I could not find their definitions anywhere in the code: Interface: \Magento\CatalogInventory\Api\Data\StockItemInterface Class: \Magento\...
0
votes
1answer
118 views

Var translator appears two times

someone knows why, if I look at the HTML code of one page from my Magento website, I see the Translator var two times, with the same values? First time: <script type="text/javascript">//<![...
2
votes
2answers
2k views

Generation of var/cache/ var/generation and var/di folders Magento2

I have a very simple question. Which magento commands cause the removal of var/cache/ var/generation/ var/di/ Folders and which bin/magento commands create them again.
1
vote
1answer
35 views

In Magento 2, what classes should be instantiated with a factory and what not?

Magento 2 has a big 'depend on abstractions, not concretions' philosophy. One example of this is the use of Factories. Automatically generated factories. But I'm wondering: from a software ...
3
votes
1answer
25 views

Generate file when installing extension

I want to create an xml file when I first install the integration in /app/code/Foo/Bar/view/frontend/layout with php. Is it possible to do so and how should it be done ? Tried with fopen in ...
1
vote
2answers
534 views

How to exclude app/code/<vendor>/<module>/vendor from code generation in Magento 2

I'm developing Magento 2 module. My composer.json file contains a dependency ("require") to netresearch/jsonmapper. I run php composer update in app/code/<vendor>/<module> folder. It ...
4
votes
3answers
1k views

Magento 2 : Google Customer Reviews

How will final result should looks like for this implementation. Thank you file location: /vendor/magento/module-checkout/Controller/Onepage/Success.php below is my default Success.php for Magento ...
0
votes
1answer
96 views

Generate dynamic page with magento 1.9. - 2.1

I have a php api to generate html code. What I'd like is to use it with magento. is posible to do it ? This is my target : run_magento() --> generate magento page By example in magento 2.1 we ...
0
votes
2answers
252 views

Label or sticker on product listing in magento

I want to show a custom label on product detail page as well as on product listing in magento 1.9.0.1 This label will be visible based on an attribute.(if I select an attribute to yes while creating ...
8
votes
2answers
12k views

Magento2 Correct Sequence to flush all Caches/Static files

I'm having a hard time in development with generated classes, pre-processed files and caches in Magento2. In comparisson with Magento1 it seems no longer possible to efficiently develop when ...
5
votes
2answers
1k views

“Invalid Factory for nonexistent class” (setup:di:compile error)

I get the following error when running bin/magento setup:di:compile: Errors during configuration scanning: IntegerNet\SolrSuggest\Implementor\Factory\AppFactory Invalid ...
10
votes
2answers
11k views

Error after deleting all cache in Magento 2

On deleting all cache as rm -rf var/cache/* var/page_cache/* var/view_preprocessed/* var/generation/* I got below error Warning: ltrim() expects parameter 1 to be string, object given in vendor\...
0
votes
1answer
116 views

Css file is generated in pub/static folder but looking at source file in browser it is not listed

After deploying my theme I see that the mycustom-m.css file is generated at /pub/static/frontend/Vendor/mytheme/en_US/css/mycustom-m.css, but it does not make any changes. Looking at the source file ...
7
votes
5answers
30k views

Magento 2 - Fatal Error “Can't create directory” var/generation/Magento/

I am experiencing a "There was a problem processing your request" after a failed mode change. I need some help. Here's the log output: a:4:{i:0;s:128:"Can't create directory var/generation/Magento/...
1
vote
1answer
212 views

Factory methods, should I manually create them?

So when I develop extensions I usually do this outside of Magento and just pull in the packages I need. Once I have developed the extension I integrate it at the end. Because of this I manually ...
1
vote
1answer
134 views

How to move module under one vendor to another vendor with the same functionality in magento 2?

I wanna move a module under app/code/vendor1 directory to app/code/vendor2 . I know that I should replace all namespace from vendor1/module1 to vendor2/module2 and replace all vendor1_module1 to ...
2
votes
1answer
125 views

Code Generator for Services in Magento 2

Magento 2 recommends us to use Service Contracts and we have to define all getter/setters explicitly in the interface and them provide a base implementation to save fields in the database. It's a lot ...
1
vote
1answer
157 views

Magento 2: What are Generated Logger Classes For?

In Magento 2, If I have a class named, say Pulsestorm\Nofrillslayout\Model\Test and I attempt to inject a non-existant class named public function __construct(Pulsestorm\Nofrillslayout\Model\Test\...
6
votes
4answers
9k views

after run bin/magento setup:upgrade got the error

I've gotten this notification: The following modules are outdated: Test_Test schema: current version - none, required version - 2.0.0 Test_Test data: current version - none, required version - ...
6
votes
1answer
360 views

What Triggers the Generation of a Proxy in Magento 2

From This link Proxy are something like lazy loading, but how Magento 2 knows it needs to generate a proxy class and which class has a proxy ?
5
votes
1answer
807 views

magento2 what exactly purpose of Factory class?

From this documentation Factories are special objects that have only one purpose: to create an instance of one non-injectable class or interface non-injectable object are Objects that cannot be ...
7
votes
3answers
1k views

Generate factory or proxy in unit tests: “ReflectionException: Class …Factory does not exist”

As far as I understand, Factory and Proxy classes are generated on the fly by the autoloader if they do not exist yet in var/generation (see: What Triggers the Generation of a Factory in Magento 2) ...
8
votes
2answers
555 views

Magento 2 proxy class override

I need to override the class \Magento\Catalog\Model\Product\Link using preference, which is working fine,but the above mentioned class has a proxy class generated automatically \Magento\Catalog\Model\...
3
votes
2answers
747 views

Magento2 Plugin with Proxy

In my test extension I try create plugin for Magento\Directory\Helper\Data::isRegionRequired method. My frontend/di.xml contain: <type name="Magento\Directory\Helper\Data"> <plugin name=...
14
votes
2answers
2k views

What do “#@+” & “#@-” strings mean in the comments?

I see a lot of "#@+" & "#@-" strings in the comments of the some Magento 2 classes. \Magento\Customer\Api\Data\AttributeMetadataInterface interface AttributeMetadataInterface extends \Magento\...
11
votes
1answer
950 views

When and how are phtml templates generated in view_preprocessed?

I see lots of phtml files generated in var/view_preprocessed/html, from core modules as well as from custom modules. It looks like these are all used templates with stripped whitespace. Alan Kent ...
1
vote
1answer
801 views

Magento 2 in production mode use Dynamic/Developer factory?

I tried to search deeper in Magento 2 code generation process and found some points, which confused me. I use Magento v2.0.1-ce in production mode. Firstly, I found strange dependency in Magento/...
4
votes
1answer
731 views

Fatal error after Magento installation 'undefined method ProductExtension::setStockItem()'

When I run Magento I get PHP Fatal error: Call to undefined method Magento\Catalog\Api\Data\ProductExtension::setStockItem() in /var/www/magento/vendor/magento/module-catalog-inventory/Model/...
26
votes
2answers
2k views

How does Magento2 generate the specific ExtensionFactory and ExtensionAttributeInterface?

I would like to wrap my head around using extension attributes, for example for quote items. It is no problem adding a custom attribute to such an entity using a setup class like in Magento 1, this ...
0
votes
0answers
128 views

Recoverable Error while creating Custom query in collecition.php under resource model in magento 2

I have created a custom query in Model/ResourceModel/Notification/Collection.php file but now it shows an error in admin: Recoverable Error: Argument 5 passed to Namespace\Module\Model\...
2
votes
1answer
545 views

Magento2 is not loading di:compile generated files

I am trying to load Magento\Customer\Api\Data\CustomerExtensionFactory in a plugin using the ObjectManager injected in the Plugin constructor. The file var\generation\Magento\Customer\Api\Data\...
1
vote
1answer
2k views

ScopeConfigInterface as parameter in constructor - Magento 2 [closed]

I'm working with Magento 2, I'm still new. I have this constructor inside a controller class: public function __construct(Context $context, PageFactory $pageFactory, \Magento\Framework\App\Config\...
3
votes
2answers
2k views

Magento 2 di:compile command gives fatal error

I have taken reference of an old module (Bannerslider) created for Magento 2 Beta version and I am trying to convert it to Magento 2 stable compatible (Mycompany_Bannerslider). When I enable the ...
4
votes
1answer
661 views

magento 2 setup compile error

In magento 2.0, when I run the magento setup:di:compile command, it gives an error: [ErrorException] Declaration of Magento\Newsletter\Test\Unit\Model\Queue\TransportBuilderTes t::...
25
votes
12answers
41k views

Magento 2 Allowed Memory exhausted error when compile code

I have error when i add module.. Please re-run Magento compile command so i run below command but also display error that below when run command from root, php magento setup:di:compile Compilation ...
27
votes
3answers
43k views

Error after magento upgrade

After firing this command in CLI php bin/magento setup:upgrade I am getting below error -: Fatal error: Uncaught exception 'Magento\Framework\Exception\LocalizedException' with message 'Can't ...
1
vote
1answer
898 views

Warnings and errors during setup:di:compile-multi-tenant [duplicate]

running latest develop branch on Windows 8.1 PHP 7.0rc5: $ $PHP -d memory_limit=1024M -f bin/magento setup:di:compile-multi-tenant PHP Warning: Declaration of Magento\Newsletter\Test\Unit\Model\...
11
votes
10answers
16k views

There are no commands defined in the “setup” namespace : Magento 2

I have installed latest version of Megento 2, everything is working fine frontend, backend and functionality. I have one issue with bin/magento setup:upgrade command, when I run this command in ...