i use the Yii2-solr extension (https://www.yiiframework.com/extension/yii2-solr) to use solr insight my Yii2 application.
Today it was time to update all libraries.
After running composer update, Yii2 solr is broken.
It looks like, composer also updates PHP Solarium to 6.0. This results in the following message:
Argument 1 passed to Solarium\Core\Client\Client::__construct() must be an instance of Solarium\Core\Client\Adapter\AdapterInterface, array given, called in /var/www/app/vendor/sammaye/yii2-solr/Client.php on line 17
The solarium package entry does not exist in the main composer.json. The yii2-solr extension has its own composer.json where the dependency to solarium:"*" is defined.
If I change the yii2-solr/composer.json in order to place something like solarium:"~5.0" there, nothing is different. Still the solarium v6.x is loaded.
Removing the composer.lock and clearing composer cache also makes no difference.
After composer update a new composer.lock is created with an solarium:"*" entry.
Any idea, how to set the valid solarium version to 5.x?
There is no solarium entry in the root/main composer.json. Solarium is only used as dependency from Yii2-solr. So it is defined in Yii2-solr/composer.json
Whatever. I added an PR for the Yii2-solr extension on git, which was accepted by the Yii2-solr owner.
But composer is still strange for me. The change does not apply in the same way in each installation of the same application:
Sometimes composer did not notify the changes in Yii2-solr/composer.json where the solraium dependency was changed from “" to “~5.0”.
In this case composer still works with the solarium:"” entry. The result is, that in one installation composer loads solarium 4.x for Yii2-solr and at an different installation, composer loads solarium 6.x (newest version) as Yii2-solr dependency.
And at the 3rd installation, composer noticed the change inside Yii2-solr/composer.json and loads the solarium 5.x.
I tried different things, clearing composer caches and .lock files. No change.
Composer and I will never be friends. :-/