Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

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



33.7k
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 ;)