Possible bug in Zend_Db_Select::assemble function

1 message Options
Embed this post
Permalink
Mathieu Suen-3

Possible bug in Zend_Db_Select::assemble function

Reply Threaded More More options
Print post
Permalink
Hi,

I think that the Zend_Db_Select::assemble method is bugy.
I would expected something like:

     /**
      * Converts this object to an SQL SELECT string.
      *
      * @return string This object as a SELECT string.
      */
     public function assemble()
     {
         $sql = self::SQL_SELECT;
         foreach (array_keys($this->_parts) as $part) {
             $method = '_render' . ucfirst($part);
             if (method_exists($this, $method)) {
                 $sql = $this->$method($sql);
             }
         }
         return $sql;
     }


If so I can create un bug report. With the atteched patch

Thanks

--
-- Mathieu Suen
--

Index: global/library/Zend/Db/Select.php
===================================================================
--- global/library/Zend/Db/Select.php (revision 4086)
+++ global/library/Zend/Db/Select.php (working copy)
@@ -682,7 +682,7 @@
     public function assemble()
     {
         $sql = self::SQL_SELECT;
-        foreach (array_keys(self::$_partsInit) as $part) {
+        foreach (array_keys($this->_parts) as $part) {
             $method = '_render' . ucfirst($part);
             if (method_exists($this, $method)) {
                 $sql = $this->$method($sql);