CakeDC/cakephp-oracle-driver

array_combine error as a result of find()->toArray()

Closed this issue · 1 comments

Hello,
The information does not come up when I try a simple query below. can you check?

$this->loadModel('ModelName');
$results = $this->{ModelName}->find()->toArray();

Undefined index: CORE\src\Database\FieldTypeConverter.php, line 127
array_combine() ->CORE\src\ORM\ResultSet.php, line 469


This way everything works perfectly:
$connection = ConnectionManager::get('oracle');
$results = $connection->execute('SELECT * FROM TABLENAME')->fetchAll('assoc');

skie commented

Thats because you fogret to call all() after find. find() returns just query object but not execute it. So coorect cakephp expression would be $results = $this->{ModelName}->find()->all()->toArray();