Zend Framework

Zend_Db_Select::union doesn't implement Zend_Db_Select and string as noted in docblock

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: N/A N/A
  • Resolution: Duplicate
  • Affects Version/s: 1.6.1
  • Fix Version/s: 1.10.0
  • Component/s: Zend_Db_Select
  • Labels:
    None

Description

The docblock says that you can use a string, array, or Zend_Db_Select object as the first parameter with union, but the code does this right away:

if (!is_array($select)) {
            $select = array();
        }

Activity

Hide
Ralph Schindler added a comment -

Do you have any potential use cases for an api that would support both string and Zend_Db_Select?

-ralph

Show
Ralph Schindler added a comment - Do you have any potential use cases for an api that would support both string and Zend_Db_Select? -ralph
Hide
C Snover added a comment -

Initially I had been trying to use a Zend_Db_Select object, actually. I was expecting to be able to do something similar to

$union = $factoryB->select()->join('related', 'related.related_id = object.object_id', array())
                            ->where('related.related_id = ?')
                            ->setIntegrityCheck(false);

$select = $factoryA->select()->join('related', 'related.related_id = object.object_id', array())
                             ->where('related.related_id = ?')
                             ->union($union)
                             ->setIntegrityCheck(false);

return $factoryA->fetchAll($select);

This would be also a case where I might want to UNION a string that was custom-written for the second set of results. I didn't really expect that I need to have a fresh Zend_Db_Select object that gets called with UNION and an array.

Show
C Snover added a comment - Initially I had been trying to use a Zend_Db_Select object, actually. I was expecting to be able to do something similar to
$union = $factoryB->select()->join('related', 'related.related_id = object.object_id', array())
                            ->where('related.related_id = ?')
                            ->setIntegrityCheck(false);

$select = $factoryA->select()->join('related', 'related.related_id = object.object_id', array())
                             ->where('related.related_id = ?')
                             ->union($union)
                             ->setIntegrityCheck(false);

return $factoryA->fetchAll($select);
This would be also a case where I might want to UNION a string that was custom-written for the second set of results. I didn't really expect that I need to have a fresh Zend_Db_Select object that gets called with UNION and an array.
Hide
Benjamin Eberlei added a comment -

Fixed as duplicate of ZF-4772

Show
Benjamin Eberlei added a comment - Fixed as duplicate of ZF-4772

People

Vote (5)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: