Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] wrong SQL statements #1631

Closed
le51 opened this issue Dec 3, 2013 · 2 comments

Comments

Projects
None yet
3 participants
@le51
Copy link

commented Dec 3, 2013

Vols::find(array("columns"=>array("cdt_de_bord_id","cdt_de_bord"), "order"=>"cdt_de_bord ASC","distinct"=>"cdt_de_bord_id"))

and

$query = $this->modelsManager->createQuery("SELECT DISTINCT cdt_de_bord_id, cdt_de_bord FROM Vols ORDER BY cdt_de_bord"); $cdb = $query->execute();

result this Postgresql log:

``exécute pdo_stmt_0000000a: SELECT "vols"."cdt_de_bord_id" AS "cdt_de_bord_id", "vols"."cdt_de_bord" AS "cdt_de_bord" FROM "public"."vols" ORDER BY "vols"."cdt_de_bord" ASC`

is there something wrong ?

Postgresal & phalcon 1.3

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@le51

This comment has been minimized.

Copy link
Author

commented Dec 5, 2013

Workaround with :

$pilotes = $this->db->fetchAll("SELECT DISTINCT cdt_de_bord_id, cdt_de_bord FROM vols ORDER BY cdt_de_bord", Phalcon\Db::FETCH_NUM); //this give the correct response $this->view->setVar('pilotes',$pilotes);

and in view:

` {% for pilote in pilotes %} {{ pilote[1] }} {% endfor %} `

but it seems that modelManager doesn't translate correctly the request and escape the DISTINCT keyword.

@niden niden added Unassigned and removed Unassigned labels Apr 3, 2014

@andresgutierrez

This comment has been minimized.

Copy link
Contributor

commented May 21, 2015

Can you please try again using Phalcon 2 or close this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.