Gii generated database code Questions

I am NEEEEWWWWWW to frameworks, but have a fare amount of knowledge in PHP/HTML/CSS

I successfully installed Yii, generated WebApp, and got Gii to generate Model/CRUD. Now what? :)

Actually my question is How/where/why does the generated code works as it does?

I generated a model called employees, when I go to this page I get everybody. I can see this a default, but need to change it to show only IsActive=1; I just can’t find the “sql” that querys the database to be able to modify it, OR what/where to change some array() for the default action to set the filter.

Now the Huh/What question: In the admin (Manage) code the “Complete List” of employees is ONLY the ones that match the mySQL defined default values. If I am Managing my list of employees, I probably want to see ALL of them not just the ones that don’t have there Home Number set. (Actually I default HomeNumber to ‘See Cell’, but you get what I mean.)

Thanks in advance.

Jeff

Go to protected/controllers/EmployeeControllers.php

Find this method:




	public function actionIndex()

	{

	    $this->render('index',array(

	        'dataProvider'=>$dataProvider,

	    ));

	}



And add criteria:




	public function actionIndex()

	{

	    $dataProvider=new CActiveDataProvider('Employees', array(

                'criteria'=>array(

                    'condition'=>'IsActive = 1',

                )

            ));

	    $this->render('index',array(

	        'dataProvider'=>$dataProvider,

	    ));

	}



But about this question:

"Actually my question is How/where/why does the generated code works as it does?"

The ‘solution’ is maybe here:

http://www.yiiframework.com/files/yii-guide-1.1.2.pdf

:)

Thanks for the reply to question will try when I get back.

As for the above:

I looked through that document but still couldn’t get a good idea of where to put my includes from the descriptions in Sec. 2.10.5 Directory.

Thanks again

Sorry wrong post question :blink: