2008年11月3日星期一

Re: [fw-mvc] _request

Hi,

The fetchAll() function is indeed capable of taking a
Zend_Db_Table_Select object, but it can also take separate arguments for
WHERE, ORDER, COUNT and OFFSET. The fetchAll() method signature is:
public function fetchAll($where = null, $order = null, $count = null,
$offset = null);

I therefore think the reason behind Erdal's problem is the fact that the
parameter "type" is being cast to an INT, yet in the example request Uri
the type is "PHP", which is a string... The invocation of the fetchAll()
seems to be correct.

Cheers,

Steve

aurelijus@astdev.lt wrote:
> Hi,
> FetchAll method requires using select()
> (http://framework.zend.com/manual/en/zend.db.select.html)
> In your situation, it should look something like this:
> $articles = new Articles();
> $type= (int)$this->_request->getParam('type');
> $select = $articles->select()->where('type = ?', $type);
> $this->view->articles = $articles->fetchAll($select);
>
> --
> Aurelijus Valeiša
> http://www.Aurelijus.eu
>
>
> On Sat, Nov 1, 2008 at 11:03 PM, Erdal YAZICIOGLU
> <erdal.yazicioglu@gmail.com <mailto:erdal.yazicioglu@gmail.com>> wrote:
>
> Hello
>
> I am trying to get the request from with type but everytime I am
> endind up with fetching all the records from database..
>
> The request is coming as
> article/view/type/PHP
> So under the ArticleController I created a viewAction function as...
> $articles = new Articles();
> $type= (int)$this->_request->getParam('type');
> $this->view->articles = $articles->fetchAll('type='.$type);
>
> When I click the article type it still lists me all the
> articles...Can you guys give me an hint or link to read..
>
> Thanks
>
>

没有评论: