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

added the possibility to use column names as keys for the types in Connection::insert() #271

Closed
wants to merge 1 commit into from

Conversation

fabpot
Copy link
Member

@fabpot fabpot commented Feb 12, 2013

The Connection::insert() method takes an array of types as its third argument:

$conn->insert('foo', array('foo' => 'foo', 'date' => new \DateTime()), array(2 => 'datetime'));

But without looking at the implementation, I'm sure you would have written the following instead:

$conn->insert('foo', array('foo' => 'foo', 'date' => new \DateTime()), array('date' => 'datetime'));

But unfortunately, that's does not work. This commit add support for this, and of course, the old way still works.

@doctrinebot
Copy link

Hello,

thank you for positing this Pull Request. I have automatically opened an issue on our Jira Bug Tracker for you with the details of this Pull-Request. See the Link:

http://doctrine-project.org/jira/browse/DBAL-445

@stof
Copy link
Member

stof commented Feb 12, 2013

could you add a unit test for this ?

Otherwise, I'm +1 for this. I also expected the column name to work when I saw it.

And please implement it also for update, otherwise it will be even more confusing.

…nnection insert() and update() methods

The Connection::insert() and Connection::update() methods take an array
of types as their third argument:

$conn->insert('foo', array('foo' => 'foo', 'date' => new \DateTime()),
array(2 => 'datetime'));

But without looking at the implementation, I'm sure you would have
written the following instead:

$conn->insert('foo', array('foo' => 'foo', 'date' => new \DateTime()),
array('date' => 'datetime'));

But unfortunately, that's does not work. This commit add support for
this, and of course, the old way still works.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants