{ public $userId; public function run() { $userId = $this->userId; $existed = CompanyListingAgreement::model()->exists(array('condition' => 'user_id=:user', 'params' => array(':user' => $userId))); if ($existed) { return; } $model = new CompanyListingAgreement('show-popup'); $model->user_id = $userId;