In Typo3 version 6.1, I have written some custom queries in My extension Repository
for example in file Mytest/Classes/Domain/Repository/MytestRepository.php
class MytestRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
public function myFunction(){
$sql = 'SELECT * FROM some_table ';
$sqlResult = $GLOBALS['TYPO3_DB']->sql_query($sql);
while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($sqlResult)) {
$rowone = $row['rowone'];
}
}
}
And calling that function in controller
$test = $this->MytestRepository->myFunction();
But the issue here is, I am getting error
Fatal error: Call to a member function fetch_assoc() on a non-object in /home/src/typo3_src-6.1.1/typo3/sysext/core/Classes/Database/DatabaseConnection.php on line 1029
Anybody have the solution ? Thanks in advance.