Issues

ZF-1692: Allow extension of Zend_Db_Select join types

Description

since I need to use the MySQL specific STRAIGHT_JOIN Syntax to optimize the run time for some queries, I had to extend Zend_Db_Select.

I created a Travello_Db_Select_Mysql class which extends the Zend_Db_Select class. Then I added a new constant STRAIGHT_JOIN and a new method {{joinStraight()}}. Until now everything is fine, but now I got two problems with the {{Zend_Db_Select::_join()}} method of Zend_Db_Select.

  1. The first row of the {{Zend_Db_Select::_join()}} method looks like this:

   $joinTypes = array(self::INNER_JOIN, self::LEFT_JOIN,
                      self::RIGHT_JOIN, self::FULL_JOIN,
                      self::CROSS_JOIN, self::NATURAL_JOIN);

To add my {{self::STRAIGHT_JOIN}} constant I need to copy the whole {{Zend_Db_Select::_join()}} method and the only thing I need to change is this first row.

  1. Since the method {{Zend_Db_Select::_uniqueCorrelation()}} is defined as private I get a fatal error. So I had to change {{Zend_Db_Select::_uniqueCorrelation()}} from private to protected.

Is there a chance that Zend_Db_Select could be changed a little to avoid these problems when extending Zend_Db_Select, i.e.

  1. Create an extensible method which creates the {{$joinTypes}} Array in the {{Zend_Db_Select::_join()}} method

  2. Change {{Zend_Db_Select::_uniqueCorrelation()}} from private to protected

Comments

Reformatted summary and description a little bit.

Resolved in r7508