Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'hotfix/ZF2-514' of git://github.com/kpieters/zf2 into k…

…pieters-hotfix/ZF2-514
  • Loading branch information...
commit 294ad43ee5f8a3eb2f387eea2a792eb5766e7e75 2 parents b5f1a44 + ca24ad1
@ralphschindler ralphschindler authored
View
4 library/Zend/Db/Sql/Select.php
@@ -573,7 +573,9 @@ protected function processSelect(PlatformInterface $platform, Adapter $adapter =
$adapter,
$this->processInfo['paramPrefix'] . ((is_string($jKey)) ? $jKey : 'column')
);
- $parameterContainer->merge($jColumnParts->getParameterContainer());
+ if ($parameterContainer) {
+ $parameterContainer->merge($jColumnParts->getParameterContainer());
+ }
$jColumns[] = $jColumnParts->getSql();
} else {
$name = (is_array($join['name'])) ? key($join['name']) : $name = $join['name'];
View
15 tests/ZendTest/Db/Sql/SelectTest.php
@@ -253,7 +253,7 @@ public function testOrder()
}
/**
- * @testdox unit test: Test join() returns same Select object (is chainable)
+ * @testdox unit test: Test having() returns same Select object (is chainable)
* @covers Zend\Db\Sql\Select::having
*/
public function testHaving()
@@ -275,7 +275,7 @@ public function testGetRawStateViaHaving(Select $select)
}
/**
- * @testdox unit test: Test join() returns same Select object (is chainable)
+ * @testdox unit test: Test group() returns same Select object (is chainable)
* @covers Zend\Db\Sql\Select::group
*/
public function testGroup()
@@ -746,6 +746,16 @@ public function providerData()
'processOrder' => array(array(array('isnull("name") DESC'), array('"name"', Select::ORDER_ASCENDING)))
);
+ // join with expression in COLUMNS part (ZF2-514)
+ $select35 = new Select;
+ $select35->from('foo')->join('zac', 'm = n', array('bar' => new Expression("IF(foo.id = 1, NULL, foo.bar)")));
+ $sqlPrep35 = // same
+ $sqlStr35 = 'SELECT "foo".*, IF(foo.id = 1, NULL, foo.bar) AS "bar" FROM "foo" INNER JOIN "zac" ON "m" = "n"';
+ $internalTests35 = array(
+ 'processSelect' => array(array(array('"foo".*'), array('IF(foo.id = 1, NULL, foo.bar)', '"bar"')), '"foo"'),
+ 'processJoins' => array(array(array('INNER', '"zac"', '"m" = "n"')))
+ );
+
/**
* $select = the select object
* $sqlPrep = the sql as a result of preparation
@@ -790,6 +800,7 @@ public function providerData()
array($select32, $sqlPrep32, array(), $sqlStr32, $internalTests32),
array($select33, $sqlPrep33, array(), $sqlStr33, $internalTests33),
array($select34, $sqlPrep34, array(), $sqlStr34, $internalTests34),
+ array($select35, $sqlPrep35, array(), $sqlStr35, $internalTests35),
);
}
Please sign in to comment.
Something went wrong with that request. Please try again.