I get the following error when running bin/magento setup:di:compile
:
Errors during configuration scanning:
IntegerNet\SolrSuggest\Implementor\Factory\AppFactory
Invalid Factory for nonexistent class IntegerNet\SolrSuggest\Implementor\Factory\App in file [...]/vendor/integer-net/solr-magento2/src/Model/Cache.php
The AppFactory
is actually a real interface from a library, it should not be generated by Magento. As far as I understood the generation, factories are only generated if the class does not exist. I double checked that the file exists and the directory is registered in vendor/composer/autoload_psr4.php
.
This is how the class that depends on the factory looks like:
Cache.php
<?php
namespace IntegerNet\Solr\Model;
use IntegerNet\SolrSuggest\Implementor\Factory\AppFactory;
class Cache
{
/**
* @var AppFactory
*/
private $appFactory;
public function __construct(AppFactory $appFactory)
{
$this->appFactory = $appFactory;
}
}
And this is the factory:
AppFactory.php
<?php
namespace IntegerNet\SolrSuggest\Implementor\Factory;
use IntegerNet\SolrSuggest\Implementor\Factory\CacheWriterFactory;
use IntegerNet\SolrSuggest\Implementor\Factory\ConfigFactory;
interface AppFactory extends ConfigFactory, CacheWriterFactory
{
}
I defined a preference for the interface in di.xml
:
<preference for="IntegerNet\SolrSuggest\Implementor\Factory\AppFactory" type="IntegerNet\Solr\Model\Bridge\AppFactory" />
Any idea what I can do about these messages?
Observation
In developer mode where I don't explicitly run the compile command, I don't get any errors. And although I get these error messages, compilation runs through and everything works - which proves that the factory classes can be used.