Вопрос

In this code :

class IndexController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
        $records = new Application_Model_Mapper_Record();
        $this->view->records = $records->fetchAll(array('type = ?' => 0));
    }


}

... fetchAll() ignores my $where clause and retrieves all the records instead of only retrieving records with type=0.

I tried with array('type = 0'), same problem. I did a var_dump($where) in my mapper fetchAll() method, but nothing particular appeared, the array seems to be okay.

What should I do ? I have absolutely no idea why it does that, and it appears I'm the only one to have this issue on the Internets.

Это было полезно?

Решение

$rowSet = $this->dbTable->fetchAll($where = null, $order = null, $count = null, $offset = null);

Just replace with $rowSet = $this->dbTable->fetchAll($where, $order, $count, $offset); in your mapper class. Because when you call this method, you assign null to the method arguments. It's method call, not initialize.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top