Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-320

allow SQL QueryBuilder to do INSERTS

    Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.5
    • Component/s: None
    • Security Level: All
    • Labels:
      None

      Description

      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.

        Issue Links

          Activity

          Show
          Steve Müller added a comment - Fixed in commit: https://github.com/doctrine/dbal/commit/7502dae2e0d8e01e2f6f08cb5323ed754e72bac4
          Hide
          Doctrine Bot added a comment -

          A related Github Pull-Request [GH-184] was closed:
          https://github.com/doctrine/dbal/pull/184

          Show
          Doctrine Bot added a comment - A related Github Pull-Request [GH-184] was closed: https://github.com/doctrine/dbal/pull/184
          Hide
          Tim Mundt added a comment -
          Show
          Tim Mundt added a comment - Here's the PR: https://github.com/doctrine/dbal/pull/184
          Hide
          Marco Pivetta added a comment -

          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.

          Show
          Marco Pivetta added a comment - 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.
          Hide
          Tim Mundt added a comment -

          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.

          Show
          Tim Mundt added a comment - 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.

            People

            • Assignee:
              Steve Müller
              Reporter:
              Tim Mundt
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: