In my custom module for Drupal 8, I am using the following code.
$query = $this->connection->select('node_field_data', 'nf_data');
$result = $query->execute();
I want to get the first 500 rows. I tried with $query->limit(50)
, but that gives the following error.
Call to undefined method Drupal\Core\Database\Driver\mysql\Select::limit()
What is the correct code to get the first 500 rows?