You should prolly do some validation on "id" and you don't need limit or
order by. You are prolly trying to get something like the title by doing
$this->articles->getTitle() which won't work because you return a doctrine
collection instead of a doctrine record. Check in fetchOne.

In fact you should be and to just do
Doctrine::getTable('Articles')->find($request->getParameter('id') and use
the $this->articles like you want.

On Jul 16, 2010 1:37 PM, "el-sid" <[email protected]> wrote:

Hi,

i am trying to redirect by action when it returns an empty result set
using foward404Unless(). the problem is it doesnt seem to have any
effect. It just brings me a page without the content

in my action i have this

public function executeIndex(sfWebRequest $request) {

       $this->articles = Doctrine_Core::getTable('Articles')-
>getArticles($request->getParameter('id'));

       $this->forward404Unless($this->articles);
   }



this method is retrieved from the table as follows

public function getArticles($id) {

       $q = $this->createQuery('a')
                       ->where('a.category_id =?', $id)
                       ->orderBy('a.id')
                       ->limit('1');

       return $q->execute();
   }

i have a few records in the database that call this method and data is
displayed. but where there is no record, the forward404Unless() method
does not redirect

--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]<symfony-users%[email protected]>
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to