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

Phalcon ORM column type is integer[]

Hi i have a problem. I have a table that contains the columns: id(PK), name(text), mix(integer[])

i use postgresql and i try to execute condition:

SELECT * FROM table t WHERE 1 <> ALL(mix)

Table::find(['conditions' => '1 <> ALL(mix)']);

PHP Fatal error: Uncaught Phalcon\Mvc\Model\Exception: Syntax error, unexpected EOF in

How to handle array types in the Phalcon? documentation says nothing about. (Phalcon\Mvc\Model\Resultset\Simpl is a last resort)

Hi @l770277 try with this

Table::find([
    'conditions' => '1 <> ALL({mix:array-int})', 
    'bind' => [
        'mix' => [1,2,3, ... ] // your integer[]
    ]
]);

{param:array-int} works with integer array. If you want string only use {param:array}

Then you can read binding parameters docs

Good luck



1.3k

Thank you for the answer. But 'mix' is the column, not a array parameter. '1' is value of mix(ok '1' should be bind parameter). I want to find rows contains 1 in mix column



32.2k
Accepted
answer

Well All() function is supported by PHQL dialect. You can try with use a raw sql or comment that line to check that the error is there