function EntityWorkspaceConflictConstraintValidatorTest::reloadEntity

Reloads the given entity from the storage and returns it.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity to be reloaded.

Return value

\Drupal\Core\Entity\EntityInterface The reloaded entity.

1 call to EntityWorkspaceConflictConstraintValidatorTest::reloadEntity()
EntityWorkspaceConflictConstraintValidatorTest::testNewEntitiesAllowedInDefaultWorkspace in core/modules/workspaces/tests/src/Kernel/EntityWorkspaceConflictConstraintValidatorTest.php
@covers ::validate

File

core/modules/workspaces/tests/src/Kernel/EntityWorkspaceConflictConstraintValidatorTest.php, line 141

Class

EntityWorkspaceConflictConstraintValidatorTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21workspaces%21src%21Plugin%21Validation%21Constraint%21EntityWorkspaceConflictConstraintValidator.php/class/EntityWorkspaceConflictConstraintValidator/11.x" title="Validates the EntityWorkspaceConflict constraint." class="local">\Drupal\workspaces\Plugin\Validation\Constraint\EntityWorkspaceConflictConstraintValidator</a> @group workspaces

Namespace

Drupal\Tests\workspaces\Kernel

Code

protected function reloadEntity(EntityInterface $entity) : EntityInterface {
    $storage = $this->entityTypeManager
        ->getStorage($entity->getEntityTypeId());
    $storage->resetCache([
        $entity->id(),
    ]);
    return $storage->load($entity->id());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.