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.

FindFirst bind params doesn't work


Phalcon 1.3.3, Percona DB 5.6, Ubuntu.

Trying to get records from db through ORM, all variations doesn't work - i see in mysql log (created by code based on EventsManager injection) queries with bind templates but not actual data.


            $types = array(
                "guid" => Column::BIND_PARAM_STR,

            $parameters = array(
                "columns" => "parent_id",
                "conditions" => "guid = :guid:",
                "bind" => array("guid" => $guid),
                "bindTypes" => $types

            $category = GoodsCategories::findFirst($parameters);

In my mysql_query.log:

[Sun, 09 Nov 14 05:04:58 +0300][INFO] SELECT goods_categories.parent_id AS parent_id FROM goods_categories WHERE goods_categories.guid = :guid LIMIT 1

As you see, "guid" param not binded, one colon left. Equal results with "conditions" => "guid = ?0" or Criteria-style query.

Query works perfect without binds:

$category = GoodsCategories::findFirst("guid = $guid");

but i lose advanages of bind params.

Model is very simple and doesn't have any relations, only fields with getters/setters: id, parent_id, guid

Where is problem?

Thank you.


:guid? I think it's :guid:.


In bind array is ":guid:", in log - ":guid", not variable value.


Figured problem. Thi is s no problem with bind in findFirst, problem in db loggind logic via EventsManager which not tracked binded values.

Used db logging example from

(Want fix, closed)


@cnpait You resolved your problem, that try/catch block is an excellent solution to your problem.. I'm just not sure you what you still need in the form of a fix? Your (Want fix, closed) comment has me confused. If your own answer solved it, please mark it as the acceptable answer :)