After chapter 8: does filter on issues work?

Hello,

I’m new to Yii, so please forgive me when I am stupid here.

I followed the book so far and have now (Chapter 8) implemented the Roles.

But I have a problem on the views/issue/admin pages.

The page comes up correctly, but whatever filter (or search) I do, the result is still the same: All Issues of this project are shown, no filters applied. There are also no error messages shown so I am a littel be stuck here.

Can anyody please confirm that this should work at this point of the book?

I do know that the book does not cover everything (which is perfetly fine).

So if this is supposed NOT to work as this is not covered in the book then I am o.k. with it.

Otherwise I have to look for an error, but as there is no error message coming up, it is kind of hard to figure out…

I have just checked the logfile.

If I compare the view/project/admin with view/issue/admin then I can see a difference when applying a filter:




2011/04/27 10:55:27 [trace] [system.db.CDbCommand] Querying SQL: SELECT * FROM `tbl_project` `t` WHERE name LIKE :ycp0 LIMIT 10

compared to:


2011/04/27 11:00:58 [trace] [system.db.CDbCommand] Querying SQL: SELECT * FROM `tbl_issue` `t` WHERE project_id=:projectID LIMIT 10

In both cases I have added something into the "name" filter field. So it looks like the filter is not applied at all, but only uses the project ID.

Any ideas?

Thanks for any hints in this matter,

gb5256

Are you using the downloaded codebase?

If so, there is a small issue in the Issue::search() method in the Issue AR class. Change the following two lines:


$criteria->condition='project_id=:projectID';

		

$criteria->params=array(':projectID'=>$this->project_id);

to these two instead


$criteria->addCondition('project_id=:projectID');


		

$criteria->params[':projectID']=$this->project_id;

Hello Jeff,

I have not used the downloaded version, but followed your book.

You are right, the changes you mentioned fixed this. ;D ;D ;D

Very nice.

Thank you very much for your help here, your book and your contribution to the yii in general. This is the first time for me to work with a framework. The start is quite hard especially as I did not have so much experience with OOP. But your book helped at lot.

Best regards from Amsterdam,

gb5256