diff --git a/src/Plugin/views/field/StandardList.php b/src/Plugin/views/field/StandardList.php index 748a1ea..b829280 100644 --- a/src/Plugin/views/field/StandardList.php +++ b/src/Plugin/views/field/StandardList.php @@ -2,12 +2,11 @@ /** * @file - * Definition of Drupal\views\Plugin\views\field\Standard. + * Definition of Drupal\views\Plugin\views\field\StandardList. */ namespace Drupal\search_api\Plugin\views\field; -use Drupal\views\Plugin\views\field\FieldPluginBase; use Drupal\views\Plugin\views\field\PrerenderList; /** @@ -18,10 +17,17 @@ use Drupal\views\Plugin\views\field\PrerenderList; * @ViewsField("standard_list") */ class StandardList extends PrerenderList { - public function preRender(&$values) { - } + /** + * {@inheritdoc} + */ + public function preRender(&$values) {} + + /** + * {@inheritdoc} + */ public function render_item($count, $item) { return $item; } + } diff --git a/src/Plugin/views/query/SearchApiEntityQuery.php b/src/Plugin/views/query/SearchApiEntityQuery.php index eb9b3d5..f7ce161 100644 --- a/src/Plugin/views/query/SearchApiEntityQuery.php +++ b/src/Plugin/views/query/SearchApiEntityQuery.php @@ -2,12 +2,12 @@ /** * @file - * Contains \Drupal\search_api\Plugin\views\query\SearchApiQuery. + * Contains \Drupal\search_api\Plugin\views\query\SearchApiEntityQuery. */ namespace Drupal\search_api\Plugin\views\query; -use Drupal\Core\Entity\EntityManagerInterface; +use Drupal\Core\Entity\EntityTypeManager; use Drupal\search_api\Entity\Index; use Drupal\views\ViewExecutable; @@ -24,24 +24,33 @@ use Drupal\views\ViewExecutable; // \Drupal\search_api\Query\QueryInterface here, but probably not really // possible due to conflicts. class SearchApiEntityQuery extends SearchApiQuery { - public static function getIndexFromTable($table, EntityManagerInterface $entity_manager = NULL) { + + /** + * {@inheritdoc} + */ + public static function getIndexFromTable($table, EntityTypeManager $entity_type_manager = NULL) { if (substr($table, 0, 24) == 'search_api_index_entity_') { $index_id = substr($table, 27); - if ($entity_manager) { - return $entity_manager->getStorage('search_api_index')->load($index_id); + if ($entity_type_manager) { + return $entity_type_manager->getStorage('search_api_index')->load($index_id); } return Index::load($index_id); } return NULL; } - + /** + * {@inheritdoc} + */ protected function addResults(array $results, ViewExecutable $view) { $rows = $this->retrieveItemResults($results); $this->loadResultEntities($rows); $view->result = array_values($rows); } + /** + * {@inheritdoc} + */ protected function loadResultEntities(&$results) { foreach ($results as $item_id => $result) { try { @@ -53,7 +62,7 @@ class SearchApiEntityQuery extends SearchApiQuery { } $results[$item_id]->_entity = $entity; } - catch (Exception $e) { + catch (\Exception $e) { // No entity so no wrapper to getValue(). } } diff --git a/src/Plugin/views/query/SearchApiQuery.php b/src/Plugin/views/query/SearchApiQuery.php index b3c31e6..d837cd1 100644 --- a/src/Plugin/views/query/SearchApiQuery.php +++ b/src/Plugin/views/query/SearchApiQuery.php @@ -112,17 +112,17 @@ class SearchApiQuery extends QueryPluginBase { * * @param string $table * The Views base table ID. - * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager + * @param \Drupal\Core\Entity\EntityManagerInterface $entity_type_manager * (optional) The entity manager to use. * * @return \Drupal\search_api\IndexInterface|null * The requested search index, or NULL if it could not be found and loaded. */ - public static function getIndexFromTable($table, EntityManagerInterface $entity_manager = NULL) { + public static function getIndexFromTable($table, EntityManagerInterface $entity_type_manager = NULL) { if (substr($table, 0, 17) == 'search_api_index_') { $index_id = substr($table, 17); - if ($entity_manager) { - return $entity_manager->getStorage('search_api_index')->load($index_id); + if ($entity_type_manager) { + return $entity_type_manager->getStorage('search_api_index')->load($index_id); } return Index::load($index_id); } @@ -952,13 +952,13 @@ class SearchApiQuery extends QueryPluginBase { * The option's previous value, or NULL if none was set. * * @see \Drupal\search_api\Query\QueryInterface::setOption() - */ - public function setOption($name, $value) { - if (!$this->shouldAbort()) { - return $this->query->setOption($name, $value); - } - return NULL; - } + */ + public function setOption($name, $value) { + if (!$this->shouldAbort()) { + return $this->query->setOption($name, $value); + } + return NULL; + } /** * Retrieves all options set for this search query. diff --git a/src/Plugin/views/relationship/DatasourceEntity.php b/src/Plugin/views/relationship/DatasourceEntity.php index e574085..b9ab64f 100644 --- a/src/Plugin/views/relationship/DatasourceEntity.php +++ b/src/Plugin/views/relationship/DatasourceEntity.php @@ -2,7 +2,7 @@ /** * @file - * Contains \Drupal\views\Plugin\views\relationship\Standard. + * Contains \Drupal\views\Plugin\views\relationship\DatasourceEntity. */ namespace Drupal\search_api\Plugin\views\relationship; @@ -20,6 +20,10 @@ use Drupal\views\Plugin\views\display\DisplayPluginBase; * @ViewsRelationship("search_api_datasource_entity") */ class DatasourceEntity extends RelationshipPluginBase { + + /** + * {@inheritdoc} + */ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) { parent::init($view, $display, $options); } @@ -48,12 +52,18 @@ class DatasourceEntity extends RelationshipPluginBase { ); } - + /** + * {@inheritdoc} + */ public function query() { return; } + /** + * {@inheritdoc} + */ public function calculateDependencies() { // Todo Guess this should check the datasources has the entity? } + }