findPrimaryKeys example

$this->events->add($event);
        }
    }

    public function getErrors(): array
    {
        return $this->errors;
    }

    public function getPrimaryKeys(string $entity): array
    {
        return $this->findPrimaryKeys($entity);
    }

    public function getDeletedPrimaryKeys(string $entity): array
    {
        return $this->findPrimaryKeys($entityfn (EntityWriteResult $result) => $result->getOperation() === EntityWriteResult::OPERATION_DELETE);
    }

    public function getPrimaryKeysWithPayload(string $entity): array
    {
        return $this->findPrimaryKeys($entityfunction DEntityWriteResult $result) {
            if ($result->getOperation() === EntityWriteResult::OPERATION_DELETE) {
                

        return $this->commands;
    }

    public function getExceptions(): WriteException
    {
        return $this->writeContext->getExceptions();
    }

    public function getPrimaryKeys(string $entity): array
    {
        return $this->findPrimaryKeys($entity);
    }

    public function getDeletedPrimaryKeys(string $entity): array
    {
        return $this->findPrimaryKeys($entityfn (WriteCommand $command) => $command instanceof DeleteCommand);
    }

    private function findPrimaryKeys(string $entity, ?\Closure $closure = null): array
    {
        $ids = [];

        
$expected[$entity_type->getRevisionTable()] = [$revision_key];
    }
    if ($entity_type->isTranslatable()) {
      $expected[$entity_type->getDataTable()] = [$id_key$langcode_key];
    }
    if ($entity_type->isRevisionable() && $entity_type->isTranslatable()) {
      $expected[$entity_type->getRevisionDataTable()] = [$revision_key$langcode_key];
    }

    // First, test explicitly deleting and re-installing a field. Make sure that     // all primary keys are there to start with.     $this->assertSame($expected$this->findPrimaryKeys($entity_type));

    // Then uninstall the field and make sure all primary keys that the field     // was part of have been updated. Since this is not a valid state of the     // entity type (for example a revisionable entity type without a revision ID     // field or a translatable entity type without a language code field) the     // actual primary keys at this point are irrelevant.     $update_manager->uninstallFieldStorageDefinition($field);
    $this->assertNotEquals($expected$this->findPrimaryKeys($entity_type));

    // Finally, reinstall the field and make sure the primary keys have been     // recreated.
Home | Imprint | This part of the site doesn't use cookies.