Component and action provider

I am struggling with getting a Yii component to work with a controller and an action provider.

Here’s the code I have so far:

In SiteController.php, I have added the following method:




public function actions() {

        return [

            'card.'=>[

                'class'=>'application.components.giftCard.ConfirmForm',

                'Submit'=>[

                    'id'=>Yii::app()->request->getQuery('id'),

                ]

            ]

        ];

    }



Then in /components/giftCard/ConfirmForm.php, I have the following code:




class ConfirmForm extends ZWidget {

    public $id;

    

    public function run(){

        echo 'run';

        $this->render('confirm_form',

            array(

                'id'=>$this->id,

            )

        );

    }


    public static function actions(){

        return array(

           'Submit'=>'application.components.giftCard.actions.Submit',

        );

    }

}



And finally, in /components/giftCard/actions/Submit.php, I have the following code:




class Submit extends CAction {

    public $id;


    public function run() {

        echo 'Gift card submit action';

    }

}



But when I try to visit http://localhost/site/card.Submit?id=1, I keep getting a 404 error.

Any idea what I may be doing wrong?

Found the problem… I forgot to add card.Submit to SiteController’s accessRules method:




    public function accessRules()

    {

        return array(

            array('allow',

                'actions' => array('card.Submit'),

                'users' => array('*'),

            ),

            array('deny', 

                'users' => array('*'),

            ),

        );

    }