I am trying to export data from a database to a csv file, I am using the code below to retrieve the data from the DB, but it only returns 100 rows, how can I fix that?
$criteria = craft()->elements->getCriteria(ElementType::Entry);
$criteria->section = 'educators';
$query = craft()->elements->buildElementsQuery($criteria);
$query->order('title asc');
$queryResults = $query->queryAll();
$educators = EntryModel::populateModels($queryResults);
foreach ($educators as $educator) {
//Write to file
}
getCriteria()
, i.e.$criteria = craft()->elements->getCriteria(ElementType::Entry, ['section' => 'educators', 'order' => 'title asc', 'limit' => null]);
and then just$educators = $criteria->find();
– in other words; you don't need the calls tobuildElementsQuery()
andqueryAll()
in this particular instance, and$criteria->find()
will actually return an array of EntryModels so there's no need to manually populate those.