Fix compatibilty with AI 2.0
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3566135. -->
Reported by: [mxr576](https://www.drupal.org/user/315522)
Related to !34
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>PHPStan rightfully complains when AI 2.x is installed.</p>
<pre> ------ -------------------------------------------------------------------------------------- <br> Line ai_provider_amazeeio.module <br> ------ -------------------------------------------------------------------------------------- <br> 27 Class Drupal\ai_search\Plugin\search_api\backend\SearchApiAiSearchBackend not found. <br> 🪪 class.notFound <br> 💡 Learn more at https://phpstan.org/user-guide/discovering-symbols <br> ------ -------------------------------------------------------------------------------------- <br><br> ------ --------------------------------------------------------------------------------------------------------------------------------------- <br> Line src/Plugin/VdbProvider/AmazeeioVdbProvider.php <br> ------ --------------------------------------------------------------------------------------------------------------------------------------- <br> 62 Call to an undefined static method Drupal\ai_provider_amazeeio\Vdb\Postgres\Plugin\VdbProvider\PostgresProvider::buildSettingsForm(). <br> 🪪 staticMethod.notFound <br> 91 Access to an undefined property Drupal\ai_provider_amazeeio\Plugin\VdbProvider\AmazeeioVdbProvider::$keyRepository. <br> 🪪 property.notFound <br> 💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property <br> ------ --------------------------------------------------------------------------------------------------------------------------------------- <br><br> ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- <br> Line src/Vdb/Postgres/Plugin/VdbProvider/PostgresProvider.php <br> ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- <br> 96 Access to an undefined property Drupal\ai_provider_amazeeio\Vdb\Postgres\Plugin\VdbProvider\PostgresProvider::$keyRepository. <br> 🪪 property.notFound <br> 💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property <br> 297 Parameter #3 $filters (string) of method Drupal\ai_provider_amazeeio\Vdb\Postgres\Plugin\VdbProvider\PostgresProvider::querySearch() is not contravariant with parameter #3 $filters (mixed) of <br> method Drupal\ai\AiVdbProviderInterface::querySearch(). <br> 323 Parameter #5 $filters (string) of method Drupal\ai_provider_amazeeio\Vdb\Postgres\Plugin\VdbProvider\PostgresProvider::vectorSearch() is not contravariant with parameter #5 $filters (mixed) <br> of method Drupal\ai\AiVdbProviderInterface::vectorSearch(). <br> 500 Parameter $embedding_strategy of method Drupal\ai_provider_amazeeio\Vdb\Postgres\Plugin\VdbProvider\PostgresProvider::indexItems() has invalid type <br> Drupal\ai_search\EmbeddingStrategyInterface. <br> 🪪 class.notFound <br> 511 Call to an undefined method Drupal\ai_provider_amazeeio\Vdb\Postgres\Plugin\VdbProvider\PostgresProvider::deleteIndexItems(). <br> 🪪 method.notFound <br> 529 Call to an undefined method Drupal\ai_provider_amazeeio\Vdb\Postgres\Plugin\VdbProvider\PostgresProvider::validateRetrievedEmbedding(). <br> 🪪 method.notFound <br> ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- <br><br> <br> [ERROR] Found 9 errors <br> </pre><h4 id="summary-steps-reproduce">Steps to reproduce</h4>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<h3 id="summary-remaining-tasks">Remaining tasks</h3>
<h3 id="summary-ui-changes">User interface changes</h3>
<h3 id="summary-api-changes">API changes</h3>
<h3 id="summary-data-model-changes">Data model changes</h3>
issue