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

Maximum bind

helo,

When i try to use this code:

$max_order = Promowo360view::maximum(
    array(
        "column" => "360view_order",
        "conditions" => "object_id = :id",
        "bind" => array(
        "id" => 5
        ),
        "bindTypes" => array(
        "id" => Column::BIND_PARAM_INT
        )
    )
 );

i recive this

 Scanner: Unknown opcode 580 [internal function]
1 [internal function]: Phalcon\Mvc\Model\Query->execute(Array, Array)
2 [internal function]: Phalcon\Mvc\Model::_groupResult('MAX', 'maximum', Array)
3 C:\www\promowo.nl\php\app\controllers\View360Controller.php(87): Phalcon\Mvc\Model::maximum(Array)
4 [internal function]: View360Controller->saveAction()
5 [internal function]: Phalcon\Dispatcher->dispatch()
6 C:\www\testapp\php\public\index.php(31): Phalcon\Mvc\Application->handle()
7 {main}


145.0k
Accepted
answer
edited Jun '16
$max_order = Promowo360view::maximum(
    array(
        "column" => "360view_order",
        "conditions" => "object_id = :id:", // It should be :id:, not :id in phalcon orm
        "bind" => array(
        "id" => 5
        ),
        "bindTypes" => array( // bindTypes are not necessary, it will be done by modelsMetadata
        "id" => Column::BIND_PARAM_INT
        )
    )
 );


8.7k

Of course, it shoudl be :id: :) thanx