Skip to content

Loading…

DBAL-320: allow SQL QueryBuilder to do INSERTS #1505

Closed
doctrinebot opened this Issue · 12 comments

2 participants

@doctrinebot

Jira issue originally created by user tcm:

With

$db = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
$qb = $db->createQueryBuilder();

this QueryBuilder I'm able to do SELECT, UPDATE and DELETE. However, INSERT is not possible. Are there any good reasons for this?

Attached you find a patch that until now works fine for me. I don't know, however, if there are any side effects.

@doctrinebot

Comment created by @ocramius:

Insert is not supported by DQL

@doctrinebot

Comment created by tcm:

Well, that was quick and not helpful. I have read about the QueryBuilder in the ORM package. For some reason with persistence (that other libraries don't have), insert cannot be supported. However, I'm talking about DBAL here. What good reason is there not to support INSERT??

@doctrinebot

Comment created by tcm:

see previous comment, I'd appreciate some clarification

@doctrinebot

Comment created by @ocramius:

[~tcm] Ouch, no, it was my fault, sorry.
I confused the project related to the issue.

@doctrinebot

Comment created by @ocramius:

This is actually valid (even the patch, though it needs to adds tests)

@doctrinebot

Comment created by tcm:

Glad to hear there seems to be no fundamental problem with this. Can I somehow help this patch go into the code? I'm not familiar with the tests here. If you give me some pointer, maybe I can come up with something useful. On the other hand, it could be a good idea for some more involved people to have a look at this before.

@doctrinebot

Comment created by @ocramius:

You'd need to add tests in https://github.com/doctrine/dbal/blob/master/tests/Doctrine/Tests/DBAL/Query/QueryBuilderTest.php (to be included in your patch or in a github pull request)
A Github PR is also the fastest way to get your code reviewed since not everyone visits the issue tracker.

@doctrinebot

Comment created by tcm:

Here's the PR: #184

@doctrinebot

Comment created by @doctrinebot:

A related Github Pull-Request [GH-184] was closed:
#184

@doctrinebot

Comment created by @deeky666:

Fixed in commit: 7502dae

@doctrinebot

Issue was closed with resolution "Fixed"

@deeky666 deeky666 was assigned by doctrinebot
@doctrinebot doctrinebot added this to the 2.5 milestone
@doctrinebot doctrinebot closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.