Db\Sql\Insert: use of __set add a new column as if already exists #2579

Closed
zfbot opened this Issue Sep 28, 2012 · 1 comment

Comments

Projects
None yet
3 participants

zfbot commented Sep 28, 2012

Jira Information

Original Issue:ZF2-551
Issue Type:Bug
Reporter:stefy31
Created:09/13/12
Assignee:ralphschindler
Components:Zend\Db

Description

(sorry for my english :) )

For example, I have the Insert object as follows :

[columns:protected] => Array
        (
            [0] => Email
            [1] => Password
            [2] => Name
            [3] => FirstName
        )
[values:protected] => Array
        (
            [0] => myaddress@gmail.com
            [1] => monmotdepasse
            [2] => Name
            [3] => My first Name
        )

Then I apply :

$insert->Password = "mynewpassword",

So I have :

[columns:protected] => Array
        (
            [0] => Email
            [1] => Password
            [2] => Name
            [3] => FirstName
            [4] => Password
        )

    [values:protected] => Array
        (
            [0] => smelous@gmail.com
            [1] => monmotdepasse
            [2] => Mélous
            [3] => Stéphanie
            [4] => mynewpassword
        )

So I have now 2 columns "Password"
and if I try to apply this query, I have this error message :

File:

/library/Zend/Db/Adapter/Driver/Pdo/Statement.php:216

Message:

SQLSTATE[42000]: Syntax error or access violation: 1110 Column 'Password' specified twice

Thank you very much :)

zfbot commented Sep 28, 2012

This issue was ported from the ZF2 Jira Issue Tracker at
http://framework.zend.com/issues/browse/ZF2-551

Known GitHub users mentioned in the original message or comment:
@stefy31, @ralphschindler

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