Drupal \ Core \ Entity \ EntityTypeManagerInterfaceを使用して達成されます。あなたが更新できる。そこから
use Drupal\Core\Entity\EntityTypeManagerInterface;
class MyForm extends FormBase {
/**
* The storage handler class for files.
*
* @var \Drupal\file\FileStorage
*/
protected $fileStorage;
/**
* This is an example.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity
* The Entity type manager service.
*/
public function __construct(EntityTypeManagerInterface $entity) {
$this->fileStorage = $entity->getStorage('file');
}
....
}
File::load($fid)
へ$this->fileStorage->load($fid)