You know that you want something from taxonomy module so first you need to look in Drupal\taxonomy\Entity
-- or the corresponding directory -- you will find the Term
class there. Now look at the annotation, it says @ContentEntityType
and in there:
* entity_keys = {
* "id" = "tid",
* "bundle" = "vid",
* "label" = "name",
* "uuid" = "uuid"
* },
So, what you want is
$term = Term::create('taxonomy_term', array([
'name' => 'test',
'vid' => 'client',
)])->save();
because the label
entity key is name
and the bundle
entity key is vid
. I added a ->save()
call as well as I presume you wanted to save it too.