-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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?] After updating Phalcon from 3.0.0 to 3.0.1 or higher raw queries work incorrectly #13081
Comments
@yesworld Did you try latest stable Phalcon? At least just for test |
@sergeyklay yes, public function initialize(){
$this->useDynamicUpdate(true);
} |
@Jurigag Could you please try to sort out? |
Any news? @sergeyklay , @Jurigag |
Can't reproduce on phalcon 3.0.2 and on phalcon 3.2.0, please provide steps to reproduce this issue. Are you sure that issue exists on latest phalcon version? $di = new FactoryDefault();
$di->set(
'db',
function () {
$adapter = new \Phalcon\Db\Adapter\Pdo\Mysql(
[
'host' => 'localhost',
'username' => 'root',
'password' => '',
'dbname' => 'phalcon_test',
'options' => [
PDO::ATTR_EMULATE_PREPARES => false,
PDO::ATTR_STRINGIFY_FETCHES => false,
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
],
'charset' => 'utf8',
]
);
return $adapter;
}
);
class Users extends \Phalcon\Mvc\Model
{
public $id;
public $name;
public $value=0;
}
var_dump(Users::findFirst(1)->value);
$query = "UPDATE Users SET value = value + 1 WHERE id = :id:";
$di->get('modelsManager')->createQuery($query)->execute(['id' => 1]);
$di->get('modelsManager')->createQuery($query)->execute(['id' => 1]);
$di->get('modelsManager')->createQuery($query)->execute(['id' => 1]);
var_dump(Users::findFirst(1)->value);
echo phpversion("phalcon"); Results:
|
OH i see it doesn't work with |
Well on phalcon 3.2.0 it works properly so i guess issue was fixed already. |
@Jurigag If you create a new record, it will not work for you. class Users extends \Phalcon\Mvc\Model
{
public $id;
public $name;
public $value=0;
public function initialize(){
$this->useDynamicUpdate(true);
}
}
$Users = new Users();
$Users->value = 0;
$Users->save();
$id = $Users->id;
echo 'id = '. $id ;
var_dump(Users::findFirst( $id )->value);
$query = "UPDATE Users SET value = value + 1 WHERE id = :id:";
$di->get('modelsManager')->createQuery($query)->execute(['id' => $id ]);
$di->get('modelsManager')->createQuery($query)->execute(['id' => $id ]);
$di->get('modelsManager')->createQuery($query)->execute(['id' => $id ]);
var_dump(Users::findFirst( $id )->value);
echo phpversion("phalcon"); |
@Jurigag @sergeyklay |
On 3.3.x branch it works correctly. #13171 most likely this fixed it. Wait for phalcon 3.3.0 release |
In 3.0.0 the code works fine:
In 3.0.1 and higher results are different:
And another really weird thing is that if I run the mixed code PDO with Phalcon's ORM in 3.0.1 version, the code works fine:
I've found the parameter because of which the code gives me different results:
Should this parameter work exactly this way in newer versions or not?
Details
php --ri phalcon
)php -v
)The text was updated successfully, but these errors were encountered: