Model castOnHydrate and useDynamicUpdate can't be used simultaneously #12147

pfz opened this Issue Aug 16, 2016 · 6 comments


None yet

3 participants

pfz commented Aug 16, 2016 edited

My purpose is to get a configuration for a coherent type cast/bind in the ORM, while being able to use snapshots in models (and dynamic update). For instance, I have less (none) rounding problems when mysql driver delivers a float instead of a string php has to parse very carefully.

But neither PDO::ATTR_EMULATE_PREPARES to false, nor castOnHydrate work is this configuration (models using BIT column).
3rd bug is therefore the most annoying to me. 2nd was supposed to be temporary workaround, that doesn't work either... I assume ATTR_EMULATE_PREPARES is better than castOnHydrate, though i may be wrong about it.

I wrote a script to test easily all those points : phalcon_orm_datatype_bug.php
Hope it will help...

This script provides a test for #11205 as well.


  1. Whatever the settings, on Model::save(), *->id (last_insert_id) is always a string, should be cast. Not really phalcon's fault here, more a PDO bug I assume. Would be great though.
  2. can't use BIT(1) column if PDO::ATTR_EMULATE_PREPARES=false. Inserts and updates are not processed.
  3. castOnHydrateand useDynamicUpdatecan't be used(true) simultaneously.
    Model::findFirst() triggers this error :
PHP Fatal error:  Uncaught Phalcon\Mvc\Model\Exception:
Column 'id' doesn't make part of the column map


  • Phalcon 3.0.x-2d24c0e (tried also with 3.0.0) (tried also with and without xdebug)
  • Zephir 0.9.3a-dev-e716dbe641 (tried also with 0.9.4a-dev-121e9b4bf1)
  • PHP 7.0.9-1~dotdeb+8.1 (cli) ( NTS )
  • MariaDB 10.1.16
pfz commented Aug 26, 2016

Tried with 3.0.1 , no success. Is there any best practice around there ? I'm using === in my JS apis and would like the json results to be properly typed/casted. It's a nightmare since it's broken (>2.0).


I have the same problem.

@sergeyklay sergeyklay added this to the 3.0.2 milestone Aug 27, 2016
sergeyklay commented Aug 30, 2016 edited

@pfz @Besedin86
Could you please check 3.0.x branch?

git clone
cd cphalcon
git checkout 3.0.x

 # Use latest Zephir here, from master branch 
zephir fullclean 
zephir build
Besedin86 commented Aug 30, 2016 edited

@sergeyklay all is fine.
Test configuration:

  • Ubuntu 16.04
  • MariaDB 10.1.16
  • PHP 7.0.8
  • Phalcon 3.0.1
  • Zephir 0.9.4a-dev-cbfe80715d
pfz commented Aug 31, 2016

@sergeyklay issue solved for castOnHydrate with same phalcon/zephir build as Basedin86.

Though PDO::ATTR_EMULATE_PREPARES to false with BIT column still fails. May be I should open an other thread to be consistent on that matter ?


@pfz Yes, open please new issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment