We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

hasMany bind

Hi, if i try to execute this (oracle database):

$profileLists = $profile->getLists(array(
   'TYPE = ?1',
   'bind' => array(1 => 'value')
));

phalcon give me this error SQLSTATE[HY000]: General error: 1722 OCIStmtExecute: ORA-01722: invalid number

The model Profiles map 'hasMany' Lists, and Lists belongsTo Profiles.

Thank you



34.6k
Accepted
answer

if the column is numeric you have to ensure you're passing a number as parameter, you can also pass a bind type there:

use Phalcon\Db\Column;

// ...

$profileLists = $profile->getLists(array(
   'TYPE = ?1',
   'bind' => array(1 => 'value'),
   'bindType' => array(1 => Column::BIND_PARAM_INT)
));
edited Jun '15

adding:

'bindType' => array(1 => Column::BIND_PARAM_INT)

solve my problem, thank you ;)