Dependency injection to load node data When I checked the code I wrote with phpcs --standard=DrupalPractice /path/to/myController, I got the following warning. 


  WARNING | Node::load calls should be avoided in classes, use dependency injection instead.


The code I use to load the node is the following. 

use Drupal\node\Entity\Node;

public function content_load($node = NULL) {
 $noad_data = Node::load($node, NULL, TRUE);
}


How should I use dependancy injection to load a node?
The controller base class provides the method entityTypeManager() which gets the service with the same name from the container the first time you use it. You can use this service to get the node storage:

  $node_storage = $this-&gt;entityTypeManager()-&gt;getStorage('node');


and then load the node:

  $node = $node_storage-&gt;load($nid);