Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. EntityDataRepository.php

function EntityDataRepository::resolveFromStorage

File

vendor/mglaman/phpstan-drupal/src/Drupal/EntityDataRepository.php, line 38

Class

EntityDataRepository

Namespace

mglaman\PHPStanDrupal\Drupal

Code

public function resolveFromStorage(ObjectType $callerType) : ?EntityData {
    if ($callerType->equals(new ObjectType(EntityStorageInterface::class))) {
        return null;
    }
    if ($callerType->equals(new ObjectType(ConfigEntityStorageInterface::class))) {
        return null;
    }
    if ($callerType->equals(new ObjectType(ContentEntityStorageInterface::class))) {
        return null;
    }
    foreach ($this->entityData as $entityData) {
        $storageType = $entityData->getStorageType();
        if ($storageType !== null && $callerType->isSuperTypeOf($storageType)
            ->yes()) {
            return $entityData;
        }
    }
    return null;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal