<?php
namespace App\Form\Input;

class Autocomplete_Data_MiceProjectType extends \Engine\Form\Input\Autocomplete_Data_GeneralAbstract
{

	/**
	 * (non-PHPdoc)
	 * @see \Engine\Form\Input\Autocomplete_Data_GeneralAbstract::getPageResultsBulk()
	 */
	protected function getPageResultsBulk() :array
	{
		$miceProjectsTypesListObj = new \App\EntityList\MiceProjectTypes();
		$miceProjectsTypesListObj->setColumns(['micePrjTypes.name']);
		$miceProjectsTypesListObj->setFilter('micePrjTypes.name', 'LIKE', "{$this->searchString}%");
		$miceProjectsTypesListObj->setOrderBy('micePrjTypes.name', 'ASC');
		$miceProjectsTypesListObj->setLimit($this->offset, $this->resultsCountPage);

		return $this->executeSqlEntityList($miceProjectsTypesListObj);
	}

	/**
	 * (non-PHPdoc)
	 * @see \Engine\Form\Input\Autocomplete_Data_GeneralAbstract::getPageResultsFormatted()
	 */
	protected function getPageResultsFormatted(Array $pageResults)
	{
		$list = [];
		foreach($pageResults as $row) {
			$list[] = $this->getCleanItem($row['id'], $row['name']);
		}
		return $list;
	}

}