Beispiel #1
0
 public function bootstrap($app)
 {
     $customerClass = Kiwi::getCustomerClass();
     Event::on($customerClass, $customerClass::EVENT_INIT, function ($event) {
         /** @var \yincart\customer\models\Customer $customer */
         $customer = $event->sender;
         $customer->attachBehavior('group', Kiwi::getGroupBehaviorClass());
     });
 }
 /**
  * Finds the Customer model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Customer the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     /** @var \yincart\customer\models\CustomerInfo $customerInfoClass */
     $customerClass = Kiwi::getCustomerClass();
     if (($model = $customerClass::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Beispiel #3
0
 public function attacheEvents()
 {
     $customerClass = Kiwi::getCustomerClass();
     Event::on($customerClass, $customerClass::EVENT_INIT, function ($event) {
         /** @var \yincart\customer\models\Customer $customer */
         $customer = $event->sender;
         $customer->attachBehavior('category', Kiwi::getCustomerBehaviorClass());
     });
     $orderClass = Kiwi::getOrderClass();
     Event::on($orderClass, $orderClass::EVENT_AFTER_INSERT, [Kiwi::getCustomerSellerClass(), 'updateSeller']);
 }