I’m new to Yii and from what i’ve seen, i really like it.
In my application, i decided to use the CGridView to display a list with these columns :
English Word - French Word - German Word - word type - comments
Since my word table doesn’t have a column for each language (fortunately), I need to restructure the data after retrieving it from database. Therefore, I decided to use a CArrayDataProvider, since i can’t use ActiveDirectory.
I’ve succeeded to display the grid with the data, configuring the sorting, but i’m stuck with using the filters.
How i could do it?
Also, if anyone know that i could use ActiveRecord in my case, i’d glad to listen to him.
Query for retrieving data
$entries = Yii::app()->db->createCommand() ->select('e.id, w.label, l.code as languageCode, t.code as type, g.code as gender, e.comments') ->from('wordentry e') ->join('word w', 'w.wordentry_id = e.id') ->join('languages l', 'w.languages_id = l.id') ->join('wordgender g', 'w.wordgender_id = g.id') ->join('wordtype t', 'e.wordtype_id = t.id') ->where('e.users_id = :id', array(':id' => $this->_params['userId'])) ->order('e.id') ->queryAll();