Index: lib/Doctrine/Query.php =================================================================== --- lib/Doctrine/Query.php (revision 7689) +++ lib/Doctrine/Query.php (working copy) @@ -1749,7 +1751,8 @@ 'parent' => $parent, 'relation' => $relation, 'map' => null); - if ( ! $relation->isOneToOne()) { + // Fix for http://www.doctrine-project.org/jira/browse/DC-701 + if ( ! $relation->isOneToOne() && !$this->disableLimitSubquery) { $this->_needsSubquery = true; } Index: lib/Doctrine/Query/Abstract.php =================================================================== --- lib/Doctrine/Query/Abstract.php (revision 7689) +++ lib/Doctrine/Query/Abstract.php (working copy) @@ -262,6 +262,12 @@ * @var bool Boolean variable for whether or not the preQuery process has been executed */ protected $_preQueried = false; + + /** + * @var bool Boolean variable for whether the limitSubquery method of accessing tables via a many relationship should be used. + */ + // Fix for http://www.doctrine-project.org/jira/browse/DC-701 + protected $disableLimitSubquery = false; /** * Constructor. @@ -2140,4 +2146,26 @@ { return $this->getDql(); } + + /** + * getDisableLimitSubquery + * gets the disableLimitSubquery property. + * + * @return boolean + */ + public function getDisableLimitSubquery() + { + return $this->disableLimitSubquery; + } + + /** + * setDisableLimitSubquery + * Allows you to set the disableLimitSubquery property -- setting this to true will restrict the query object from using the limit sub query method of tranversing many relationships. + * @param boolean $disableLimitSubquery + */ + public function setDisableLimitSubquery($disableLimitSubquery) + { + $this->disableLimitSubquery = $disableLimitSubquery; + } + } \ No newline at end of file