I have an "Question" entity, and I need to updates its 'key' field (of string type):
My code isn't working:
$storage = \Drupal::entityManager()->getStorage('question');
$query = $storage->getQuery();
$query
->condition('key', $key);
$entity = $query->execute();
$entity -> set ('key', 'new_value');
$entity->save();
It returns the error Fatal error: Call to a member function set() on a non-object