Zend Framework

Fetching methods for Zend_Db_Table_Select

Details

  • Type: Improvement Improvement
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: Zend_Db_Select
  • Labels:
    None

Description

<?php

// Example

// we can instantiate paginator in controller
$this->view->paginator = $table->getPaginator($table->getSelectLastNews(), $page, $limit);

// and fetch all entries
$this->view->last_news = $table->fetchAll($table->getSelectLastNews());


// OR we can use the following code

$this->view->paginator = $table->getSelectLastNews()->getPaginator($page, $limit);
$this->view->last_news = $table->getSelectLastNews()->fetchAll(/* $limit */);

// solution in Db_Table_Select
public function fetchAll($limit = 10) // proxy
{
    return $this->getTable()->fetchAll($this->limit($limit));
}

public function getPaginator($page, $limit = 10) // proxy
{
    // assume we have Paginator in Model
    return $this->getTable()->getPaginator($select, $page, $limit);
}

Activity

There are no comments yet on this issue.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated: