I have written a component as below.
class GoogleApiComponent extends Component {
function __construct($approval_prompt) {
$this->client = new apiClient();
$this->client->setApprovalPrompt(Configure::read('approvalPrompt'));
}
}
I am calling this in $components variable of AppController. Then I have written UsersController as below.
class UsersController extends AppController {
public function oauth_call_back() {
}
}
So in oauth_call_back action I wanna create object of GoogleApiComponent and also call the constructor with parameter. How to do it in CakePHP 2.1?