Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Duplicate
-
Affects Version/s: 1.6.0RC1
-
Fix Version/s: None
-
Component/s: Zend_Paginator
-
Labels:None
Description
Instances of Zend_Db_Table_Select do not work with Zend_Paginator unless you specify a from clause (which is redundant for Zend_Db_Table_Select).
<?php
// Does not work
$table = new MyTable();
$select = $table->select();
$paginator = Zend_Paginator::factory($select); // Throws exception "No table has been specified for the FROM clause"
// This works
$table = new MyTable();
$select = $table->select()
->from($table); // Required by Zend_Paginator
$paginator = Zend_Paginator::factory($select); // Works
?>
Issue Links
| This issue depends on: | ||||
| ZF-3239 | 'From' table not available in $_parts in Zend_Db_Table_Select |
|
|
|
Paginate can't use a Zend_Db_Table_Select until that object knows which table its supposed to use. This is actually a duplicate of <a href="http://framework.zend.com/issues/browse/ZF-3239">http://framework.zend.com/issues/browse/ZF-3239</a>.
=Doesn't work=
$player = new Player();
$select = $player->select()->order('lastname DESC'); //object still doesn't know what table its going to use
$paginator = Zend_Paginator::factory($select);
=Works=
$player = new Player();
$select = $player->select()->order('lastname DESC');
$select->__toString(); //hack to force the object to set its table!
$paginator = Zend_Paginator::factory($select);