copyData example

// Check that the fields required by a revisionable and translatable       // entity type exist.       if ($entity_type->isRevisionable() && $entity_type->isTranslatable() && !isset($field_storage_definitions[$entity_type->getKey('revision_translation_affected')])) {
        throw new EntityStorageException('Missing revision_translation_affected field.');
      }

      $this->preUpdateEntityTypeSchema($entity_type$original$field_storage_definitions$original_field_storage_definitions$sandbox);
    }

    // Copy data from the original storage to the temporary one.     if ($has_data) {
      $this->copyData($entity_type$original$field_storage_definitions$original_field_storage_definitions$sandbox);
    }
    else {
      // If there is no existing data, we still need to run the       // post-schema-update tasks.       $sandbox['#finished'] = 1;
    }

    // If the data copying has finished successfully, allow the storage schema     // to do any required cleanup tasks. For example, this process should take     // care of transforming the temporary storage into the current storage.     if ($sandbox['#finished'] == 1) {
      

        $this->db->query('PRAGMA foreign_keys = OFF');

        $this->db->transStart();

        $this->forge->renameTable($this->tableName, "temp_{$this->tableName}");

        $this->forge->reset();

        $this->createTable();

        $this->copyData();

        $this->forge->dropTable("temp_{$this->tableName}");

        $success = $this->db->transComplete();

        $this->db->query('PRAGMA foreign_keys = ON');

        $this->db->resetDataCache();

        return $success;
    }

    
Home | Imprint | This part of the site doesn't use cookies.