/** * @author Hungpx * @param \Accounting\Model\ExpenseCategory $item * @param array $parentIds * @return NULL|Ambigous <multitype:unknown , NULL> */ public function suggest($item) { $dbAdapter = $this->getDbAdapter(); $item->prepairSuggest(); $select = $this->getDbSql()->select(self::TABLE_NAME); $select->where(['(name LIKE ?)' => ['%' . $item->getName() . '%']]); $query = $this->getDbSql()->buildSqlString($select); $results = $dbAdapter->query($query, $dbAdapter::QUERY_MODE_EXECUTE); $result = array(); if ($results->count()) { $row = array(); foreach ($results as $value) { $row['id'] = $value['id']; $row['name'] = $value['name']; $row['label'] = $value['name']; $result[] = $row; } } return $result; }