Which Action Called When Generate Button Of Gii Code Generator Clicked For Model And Crude Generator

I am quite new to the yii.

I want to customize Gii Code Generator so please help me out when generator button of model generator or crud generator is clicked at that time which method of which file is called.

and also i can’t understand why generate button directly not worked with out previewing.

please help me out.