I'm not sure if this makes sense, but coming into the D8 entity API as a user this was very confusing.
I was converting Spark to Drupal 8, and got this error:
An AJAX HTTP error occurred. HTTP Result Code: 200 Debugging information follows. Path: http://localhost/spark-git/8xx/core/install.php?langcode=en&profile=spar... StatusText: OK ResponseText: Recoverable fatal error: Argument 1 passed to taxonomy_vocabulary_save() must be an instance of Drupal\taxonomy\Vocabulary, instance of stdClass given, called in /Users/abyron/Sites/spark-git/8xx/profiles/spark/spark.install on line 269 and defined in taxonomy_vocabulary_save() (line 442 of /Users/abyron/Sites/spark-git/8xx/core/modules/taxonomy/taxonomy.module).
"Ah-ha!" I thought to myself, sipping some newly acquired Cherry Coke from a recent trip to Bellingham. "This is because of that new fancy-pants OO Entity API. Well then! Let's dig in."
Here's what my old code was in Drupal 7:
$vocabulary = (object) array( 'name' => st('Tags'), 'description' => $description, 'machine_name' => 'tags', 'help' => $help, ); taxonomy_vocabulary_save($vocabulary);
Here's what I expected the new code to be in Drupal 8:
use Drupal\taxonomy\Vocabulary; ... $vocabulary = new Vocabulary(); $vocabulary->name = st('Tags'); $vocabulary->description = $description; $vocabulary->machine_name = 'tags'; $vocabulary->help = $help; $vocabulary->save();
Here's what the code actually is in standard.install:
$vocabulary = entity_create('taxonomy_vocabulary', array( 'name' => st('Tags'), 'description' => $description, 'machine_name' => 'tags', 'langcode' => language_default()->langcode, 'help' => $help, )); taxonomy_vocabulary_save($vocabulary);
Also, I have no idea why we are duplicating tags and issue components, but doing the same here since that seems to be what other people do.