Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Create queryBuilder from parts. #256

Closed
wants to merge 2 commits into from

3 participants

@NoUseFreak

Add a feature that can create a queryBuilder from queryBuilder parts.

This can be used when a query is build and needs to be stored somehow and restore it later.

@doctrinebot
Collaborator

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-426

@stof stof commented on the diff
lib/Doctrine/DBAL/Connection.php
@@ -1306,4 +1306,26 @@ public function createQueryBuilder()
{
return new Query\QueryBuilder($this);
}
+
+ /**
+ * Create a QueryBuilder instance from DQL parts
@stof
stof added a note

DQL ? in DBAL ?

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

thus, this is not setting anything in the connection

@NoUseFreak

Indeed. As I should have noticed, this should not be in this project as it is possible to add them later. This can be ignored.

@NoUseFreak NoUseFreak closed this
@NoUseFreak NoUseFreak deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 25, 2013
  1. @NoUseFreak
  2. @NoUseFreak

    Update method name.

    NoUseFreak authored
This page is out of date. Refresh to see the latest.
Showing with 22 additions and 0 deletions.
  1. +22 −0 lib/Doctrine/DBAL/Connection.php
View
22 lib/Doctrine/DBAL/Connection.php
@@ -1306,4 +1306,26 @@ public function createQueryBuilder()
{
return new Query\QueryBuilder($this);
}
+
+ /**
+ * Create a QueryBuilder instance from DQL parts
@stof
stof added a note

DQL ? in DBAL ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ *
+ * @param array $parts
+ *
+ * @return Query\QueryBuilder
+ */
+ public function setDQLParts(array $parts = array())
+ {
+ $queryBuilder = new Query\QueryBuilder($this);
+ foreach ($parts as $name => $part)
+ {
+ if ($part) {
+ if (is_array($part) && $name != 'join') {
+ $part = current($part);
+ }
+ $queryBuilder->add($name, $part);
+ }
+ }
+ return $queryBuilder;
+ }
}
Something went wrong with that request. Please try again.