Skip to main content

Questions tagged [code-generation]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
0 answers
21 views

how to get dependency graphs - problems in generated code

I am trying to look at dependency graphs by setting MAGE_PROFILER=2, as explained here. When I do, I get an error like Fatal error: Declaration of Magento\Framework\Interception\Config\CacheManager\...
Michael Wolf's user avatar
0 votes
1 answer
401 views

how to locate source code of page in admin panel

how can i locate any exact source code page to change content . for example how can i locate Customers --> All Customers --> then select one customer then press edit --> how can i found this ...
Hamad Al-Shabrawi's user avatar
0 votes
1 answer
34 views

Does magento offers a crud CLI

I was wondering if magento was offering a CRUD CLI like Symfony would do. You get a prompt that ask you your entity fields and once your entered them all then the entity and it's related repository is ...
Claims's user avatar
  • 1,191
0 votes
1 answer
190 views

Use of external library with interfaces - Error: Cannot declare interface, because the name is already in use

I try to use an external library in my Magento2 module. The library is the Amazon MWS-PHP Library. I included the library via composer.json in PSR-0 Format since classnames are in PSR-0 standard (like ...
ulbiopro's user avatar
0 votes
0 answers
100 views

Magento 2 creating an auto invoice at the time of shipment getting an error on the order view page

Magento 2 creating an auto invoice at the time of shipment getting an error on the order view page. After successfully creating an invoice when the page redirected to order view getting an error ...
Roshan Rakesh Yadav's user avatar
2 votes
1 answer
156 views

Generating other classes beside the core ones

As described in https://devdocs.magento.com/guides/v2.3/extension-dev-guide/code-generation.html some classes are autogenerated on request (or at di:compile) based on some rules. For example if a ...
Marius's user avatar
  • 198k
2 votes
1 answer
430 views

Add a block to programmatically generated widget

I need to generate a widget block with upgradeData.php and assign a block to this widget how can I do this? Folowing is my code for widget generation: Setup/UpgradeData.php public function ...
Prateek's user avatar
  • 308
1 vote
2 answers
147 views

Unable to run commans in magento 2

I have tried to disable Magento_CatalogSearch in config.php. After edited config.php, While trying to run commands throws the following error. "Source class "\Magento\CatalogSearch\Model\...
Jaisa's user avatar
  • 2,626
1 vote
0 answers
17 views

what are the minimum steps to run in order to see the updates after edit a php file from the vendor folder

somehow in my /public_html/vendor/magento/module-catalog/Model/ResourceModel/Product/Indexer/Price/BatchSizeCalculator.php file there are extra characters accidentally added by one of the team ...
Mage Explorer's user avatar
0 votes
2 answers
371 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--------------...
Wakar Ahamad's user avatar
0 votes
0 answers
531 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\...
Narendra Vyas's user avatar
6 votes
2 answers
1k 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 ...
geerlingguy's user avatar
3 votes
1 answer
1k 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
Mage's user avatar
  • 37
0 votes
1 answer
840 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/...
sv3n's user avatar
  • 11.7k
1 vote
1 answer
122 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
Prakash Raj's user avatar
0 votes
2 answers
746 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/...
mxtthxw's user avatar
  • 21
1 vote
4 answers
11k 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 ...
Matt Cosentino's user avatar
1 vote
0 answers
288 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/...
Marius's user avatar
  • 198k
3 votes
2 answers
2k 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] ...
Abhishek Tripathi's user avatar
1 vote
1 answer
322 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\...
Mac A.'s user avatar
  • 280
0 votes
1 answer
191 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">//<![...
Roberto Bianchi's user avatar
3 votes
2 answers
3k 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.
Lachezar Raychev's user avatar
1 vote
1 answer
64 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 ...
Giel Berkers's user avatar
  • 12.3k
3 votes
1 answer
31 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 ...
Eligijus's user avatar
  • 133
1 vote
2 answers
1k 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 ...
Rustem Zinnatullin's user avatar
5 votes
4 answers
2k views

Magento 2 : Google Customer Reviews

How will final result should look like for this implementation. Thank you file location: /vendor/magento/module-checkout/Controller/Onepage/Success.php Below is my default Success.php for Magento ...
roger's user avatar
  • 551
0 votes
1 answer
163 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 ...
Ricardo Cabello Torres - Brqx's user avatar
0 votes
2 answers
864 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 ...
ramya jijith's user avatar
8 votes
2 answers
23k 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 ...
leedch's user avatar
  • 405
6 votes
3 answers
3k 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 ...
Fabian Schmengler's user avatar
10 votes
4 answers
15k 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\...
sagar sapkota's user avatar
0 votes
1 answer
366 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 ...
Zinat's user avatar
  • 2,069
8 votes
5 answers
41k 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/...
Konstantinos Koletsas's user avatar
1 vote
1 answer
326 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 ...
Brideo's user avatar
  • 404
1 vote
1 answer
463 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 ...
ali gh's user avatar
  • 731
2 votes
1 answer
279 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 ...
Amasty's user avatar
  • 6,508
1 vote
1 answer
240 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\...
Alana Storm's user avatar
  • 44.4k
6 votes
4 answers
13k 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 - ...
Ayush Mittal's user avatar
6 votes
1 answer
775 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 ?
ali gh's user avatar
  • 731
5 votes
1 answer
1k 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 ...
ali gh's user avatar
  • 731
9 votes
3 answers
3k 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) ...
Fabian Schmengler's user avatar
8 votes
2 answers
934 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\...
Taral Patoliya's user avatar
3 votes
2 answers
2k 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=...
sergei.sss's user avatar
  • 1,179
15 votes
2 answers
3k 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\...
Alex Gusev's user avatar
  • 2,019
12 votes
1 answer
2k 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 ...
Fabian Schmengler's user avatar
1 vote
1 answer
1k 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/...
swnsma's user avatar
  • 111
4 votes
2 answers
2k 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/...
ahmed elesely's user avatar
33 votes
2 answers
4k 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 ...
Vinai's user avatar
  • 14k
0 votes
0 answers
132 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\...
Vishal's user avatar
  • 773
2 votes
1 answer
637 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\...
awavi's user avatar
  • 989