protected function SearchApiSolrBackend::hasHierarchicalProperties in Search API Solr 8.3
Same name and namespace in other branches
- 8 src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::hasHierarchicalProperties()
- 8.2 src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::hasHierarchicalProperties()
- 4.x src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::hasHierarchicalProperties()
Checks if hierarchical properties are nested on an entity-typed property.
Parameters
\Drupal\Core\Entity\TypedData\EntityDataDefinitionInterface $property: The property to be searched for hierarchical nested properties.
Return value
bool TRUE if the property contains hierarchical properies, FALSE otherwise.
See also
\Drupal\search_api\Plugin\search_api\processor\AddHierarchy::findHierarchicalProperties()
1 call to SearchApiSolrBackend::hasHierarchicalProperties()
- SearchApiSolrBackend::isHierarchicalField in src/
Plugin/ search_api/ backend/ SearchApiSolrBackend.php - Checks if a field is (potentially) hierarchical.
File
- src/
Plugin/ search_api/ backend/ SearchApiSolrBackend.php, line 2252
Class
- SearchApiSolrBackend
- Apache Solr backend for search api.
Namespace
Drupal\search_api_solr\Plugin\search_api\backendCode
protected function hasHierarchicalProperties(EntityDataDefinitionInterface $property) {
$entity_type_id = $property
->getEntityTypeId();
// Check properties for potential hierarchy. Check two levels down, since
// Core's entity references all have an additional "entity" sub-property for
// accessing the actual entity reference, which we'd otherwise miss.
foreach ($this->fieldsHelper
->getNestedProperties($property) as $property_2) {
$property_2 = $this->fieldsHelper
->getInnerProperty($property_2);
if ($property_2 instanceof EntityDataDefinitionInterface) {
if ($property_2
->getEntityTypeId() == $entity_type_id) {
return TRUE;
}
}
elseif ($property_2 instanceof ComplexDataDefinitionInterface) {
foreach ($property_2
->getPropertyDefinitions() as $property_3) {
$property_3 = $this->fieldsHelper
->getInnerProperty($property_3);
if ($property_3 instanceof EntityDataDefinitionInterface) {
if ($property_3
->getEntityTypeId() == $entity_type_id) {
return TRUE;
}
}
}
}
}
return FALSE;
}