function PathAliasTestTrait::loadPathAliasByConditions
Same name in other branches
- 8.9.x core/tests/Drupal/Tests/Traits/Core/PathAliasTestTrait.php \Drupal\Tests\Traits\Core\PathAliasTestTrait::loadPathAliasByConditions()
- 10 core/tests/Drupal/Tests/Traits/Core/PathAliasTestTrait.php \Drupal\Tests\Traits\Core\PathAliasTestTrait::loadPathAliasByConditions()
- 11.x core/tests/Drupal/Tests/Traits/Core/PathAliasTestTrait.php \Drupal\Tests\Traits\Core\PathAliasTestTrait::loadPathAliasByConditions()
Gets the first result from a 'load by properties' storage call.
Parameters
array $conditions: An array of query conditions.
Return value
\Drupal\path_alias\PathAliasInterface|null A path alias entity or NULL.
3 calls to PathAliasTestTrait::loadPathAliasByConditions()
- MigrateUrlAliasTest::testUrlAlias in core/
modules/ path/ tests/ src/ Kernel/ Migrate/ d6/ MigrateUrlAliasTest.php - Tests the url alias migration.
- MigrateUrlAliasTest::testUrlAliasWithTranslatedNodes in core/
modules/ path/ tests/ src/ Kernel/ Migrate/ d7/ MigrateUrlAliasTest.php - Tests the URL alias migration with translated nodes.
- MigrateUrlAliasTestBase::testUrlAlias in core/
modules/ path/ tests/ src/ Kernel/ Migrate/ d7/ MigrateUrlAliasTestBase.php - Tests the URL alias migration.
File
-
core/
tests/ Drupal/ Tests/ Traits/ Core/ PathAliasTestTrait.php, line 49
Class
- PathAliasTestTrait
- Provides methods to create and assert path_alias entities.
Namespace
Drupal\Tests\Traits\CoreCode
protected function loadPathAliasByConditions($conditions) {
$storage = \Drupal::entityTypeManager()->getStorage('path_alias');
$query = $storage->getQuery()
->accessCheck(FALSE);
foreach ($conditions as $field => $value) {
$query->condition($field, $value);
}
$entities = $storage->loadMultiple($query->execute());
return $entities ? reset($entities) : NULL;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.