Yii - Calling api request within CConsole

Hi all,

I have the following issue:

I have a local db with comments and I need to do some actions with some users I’m getting via an API request. Code is something like this:




class RunCronCommand extends CConsoleCommand {


public function actionIndex() {

    ...

    $comments = Comment::model()->findAll('status = :status', array(':status' => Comment::ACTIVE));


    foreach ($comments as $comment) {

        $profile = Yii::app()->api->get('/users/'. $comment->user_id . '/getProfile');                

    }

    ...

} 



any help is appreciated! thanks in advance!

What is the question?

You’re right, I forgot the question:

That is:

When I execute the command I’m getting this error

exception ‘CException’ with message ‘Property “CConsoleApplication.api” is not defined.’ in /var/www/core/trunk/common/lib/Yii/base/CComponent.php:131

I got rid of the error, adding my api into

console/config/main.php




     'components' => array(

         'api' => array(

             'class' => 'common.extensions.Api.Api'

         ),   

     ....                   



Now, I’m running into another issue with some Guzzle class

thanks for interest!