CakeDC / cakephp-oracle-driver

CakePHP 3 Driver for Oracle Database
Other
40 stars 24 forks source link

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

Closed sevkialacatli closed 3 years ago

sevkialacatli commented 4 years ago

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 3 years ago

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();