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

Projects
None yet
3 participants
Member

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.

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

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.

added the possibility to use column names as keys for the types in Co…
…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.

@beberlei beberlei closed this in 47411d3 Apr 14, 2013

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