entities – Unable to load multiple values of node in controller in drupal 9

Hi all i am facing issue

$query = Drupal::entityQuery(‘node’);
$query->condition(‘status’, ‘all’);
$query->condition(‘type’, ‘mytype’);
$query->sort(‘created’ , ‘DESC’);

$entity_ids  = $query->execute();
$cache_tags = ('node_list');
$items = ();
$nodes = !empty($entity_ids) ? Drupal::entityTypeManager()->getStorage('node')->loadMultiple($entity_ids) : ();

$items = array();

    
             
foreach ($nodes as $node) {
    echo '<br>';
    print_r($node->label()); // this will return all values 
  $item = ();
  $item('title') = $node->label();  // gives only one result
  $item('post_id') = $node->id();

      $nid=  $node->id();
    }
 
  $items() = $item;
 

    $response = new ResourceResponse($items);
    //$response->addCacheableDependency($build);
   // return $response;

return new JsonResponse( $items );

}
Error log shows
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalCoreEntityEntityStorageBase->loadMultiple() (line 266 of core/lib/Drupal/Core/Entity/EntityStorageBase.php).
Anyone please help me