Skip to content

Replace class-like name in catalog-search/./di.xml #7696

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

Replace class-like name in catalog-search/./di.xml #7696

wants to merge 2 commits into from

Conversation

flancer64
Copy link
Contributor

There is an error in compilation process:

$ ./bin/magento deploy:mode:set production
Enabled maintenance mode
Starting compilation
Something went wrong while compiling generated code. See the error log for details.
Command returned non-zero exit code:
`/usr/bin/php7.0 -f /.../bin/magento setup:di:compile`

if some module's di.xml contains decorator (interceptor) for virtual type Magento\Catalog\Model\ResourceModel\Product\CollectionFactory

<!-- Interceptor to get error with full-text search -->
<type name="Magento\Catalog\Model\ResourceModel\Product\CollectionFactory">
	<plugin name="flancer32_sample_plugin"
			type="Flancer32\Sample\Plugin\Catalog\Model\ResourceModel\Product\CollectionFactory"
			sortOrder="100"
			disabled="false"/>
</type>

This is an error from log:

[RuntimeException]                                                                                                                                                                               
Source class "\Magento\CatalogSearch\Model\ResourceModel\Fulltext\SearchCollection" for "Magento\CatalogSearch\Model\ResourceModel\Fulltext\SearchCollectionFactory" generation does not exist. 

We should rename original virtual type Magento\Catalog\Model\ResourceModel\Product\CollectionFactory to smth like virtualFulltextCollectionFactory to enable production mode compilation.

There is an error in compilation process:

	$ ./bin/magento deploy:mode:set production
	Enabled maintenance mode
	Starting compilation
	Something went wrong while compiling generated code. See the error log for details.
	Command returned non-zero exit code:
	`/usr/bin/php7.0 -f /.../bin/magento setup:di:compile`

if some module's `di.xml` contains decorator (interceptor) for virtual type `Magento\Catalog\Model\ResourceModel\Product\CollectionFactory`

	<!-- Interceptor to get error with full-text search -->
	<type name="Magento\Catalog\Model\ResourceModel\Product\CollectionFactory">
		<plugin name="flancer32_sample_plugin"
				type="Flancer32\Sample\Plugin\Catalog\Model\ResourceModel\Product\CollectionFactory"
				sortOrder="100"
				disabled="false"/>
	</type>

We should rename original virtual type `Magento\Catalog\Model\ResourceModel\Product\CollectionFactory` to smth like `virtualFulltextCollectionFactory` to enable production mode compilation.
@flancer64
Copy link
Contributor Author

This issue is related to PR-6096

'Factory' suffix is magic for code generation. Replaced by neutral.
@vrann
Copy link
Contributor

vrann commented Mar 15, 2017

@flancer64 it looks like the problem is that some module added plugin for the virtual type. Why would it do that?

@flancer64
Copy link
Contributor Author

Why would it do that?

@vrann , I needed to modify Product Collection query in my case. So, I have created plugin for the collection's factory.

@vrann
Copy link
Contributor

vrann commented Mar 15, 2017

@flancer64 I think you hit the bug in Magento which does not allow to add the plugin on Virtual Type. It is going to bee fixed in upcoming releases. But so far, the naming convention fro the virtual types is to use fully-qualified class names: https://community.magento.com/t5/Magento-DevBlog/Virtual-Types-Naming-Convention/ba-p/61510

Please comment there to affect this decision.

@vrann vrann closed this Mar 15, 2017
@vrann vrann self-assigned this Mar 15, 2017
@vrann vrann added this to the March 2017 milestone Mar 21, 2017
magento-devops-reposync-svc pushed a commit that referenced this pull request Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants