Drupal 8 Entity常用

获取一个Entity:

$entity = \Drupal::entityTypeManager()->getStorage('MyEntityType')->load(9);
dpm($entity);

修改Entity 数据

$entity = \Drupal::entityTypeManager()->getStorage('MyEntityType')->load(9);
$entity->myfield = 1;
$entity->save();