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.
- 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.
- 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.
Create an extensible method which creates the {{$joinTypes}} Array in the {{Zend_Db_Select::_join()}} method
Change {{Zend_Db_Select::_uniqueCorrelation()}} from private to protected
Comments
Posted by Bill Karwin (bkarwin) on 2007-07-09T15:10:31.000+0000
Reformatted summary and description a little bit.
Posted by Simon Mundy (peptolab) on 2008-01-18T21:45:03.000+0000
Resolved in r7508