0

I am building a class that only receive a Zend_Db_Rowset throught its params and from that I can extract the related Zend_Db_Table using the $rowset->getTable() method.

I was wondering if there is a way to get the order statement back from the table since I can set it (as a private property) through a dump.

object(Application_Model_DbTable_View_Formation)#107 (18) {
...
    ["_rows":protected] => array(4) {
      [0] => array(3) {
        [0] => string(7) "0.04095"
        [1] => string(20) "DESCRIBE `formation`"
        [2] => NULL
      }
      [1] => array(3) {
        [0] => string(7) "0.00047"
        [1] => string(67) "SELECT `formation`.* FROM `formation` ORDER BY `date` desc LIMIT 30"
        [2] => NULL
      }
      [2] => array(3) {
        [0] => string(7) "0.02031"
        [1] => string(22) "DESCRIBE `v_formation`"
        [2] => NULL
      }
      [3] => array(3) {
        [0] => string(7) "0.02285"
        [1] => string(135) "SELECT `v_formation`.* FROM `v_formation` WHERE (date >= '2011-01-01 12:00:00') AND (date <= '2011-12-31 11:59:59') ORDER BY `date` ASC"
        [2] => NULL
      }
    }
   ...
}
JF Dion
  • 4,014
  • 2
  • 24
  • 34
  • This is profiler storage and is connected with db. It's content hasn't any relation to current row or rowset, so you can only guess if which query is the on for that result you have. If you really hard want that query stored somewhere in your row or rowset you can extend Zend_Db_Table and/or Zend_Db (can't tell now which one) to have that, but it will require lot of work, high skills and very good knowledge of Zend_Db component and OOP. – Diabl0 Jul 20 '11 at 07:02

1 Answers1

2

What you see is Zend_Db_Profiler data. This has no relation to the actual rowset. I think you can't get the select that created that rowset.

Speaking strictly about the order for the table. You can't receive it per-se. You can only create a select with order using public $table->select()->order('id DESC'); method.

Tomáš Fejfar
  • 11,129
  • 8
  • 54
  • 82