以下のようにコンポーネントを書きました。
class GoogleApiComponent extends Component {
function __construct($approval_prompt) {
$this->client = new apiClient();
$this->client->setApprovalPrompt(Configure::read('approvalPrompt'));
}
}
これを AppController の $components 変数で呼び出しています。次に、以下のように UsersController を記述しました。
class UsersController extends AppController {
public function oauth_call_back() {
}
}
したがって、oauth_call_back アクションでは、GoogleApiComponent のオブジェクトを作成し、パラメーターを使用してコンストラクターを呼び出したいと考えています。CakePHP 2.1 でそれを行うには?