Function that sync Coupon data from MeeMe to Ocard
public function actionSynchronizeCoupons() { set_time_limit(0); ini_set('memory_limit', '-1'); $event = Event::findOne(Customer::getCurrentUserDefaultEventID()); $coupons = Coupon::find() ->joinWith('participant') ->where(['participant.event_id' => Customer::getCurrentUserDefaultEventID()]) ->andWhere(['>=', 'coupon.id', 3400]) ->all(); foreach ($coupons as $coupon) { $coupon->synchronizeCoupon($event); } Yii::$app->session->setFlash('success', Yii::t('Coupon', "Synchronization completed")); $this->redirect('index'); }