當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SplSubject::getEventObject方法代碼示例

本文整理匯總了PHP中SplSubject::getEventObject方法的典型用法代碼示例。如果您正苦於以下問題:PHP SplSubject::getEventObject方法的具體用法?PHP SplSubject::getEventObject怎麽用?PHP SplSubject::getEventObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SplSubject的用法示例。


在下文中一共展示了SplSubject::getEventObject方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: fillJoins

 /**
  * @param \SplSubject|Logic $subject
  */
 protected function fillJoins($subject)
 {
     $models = $subject->getEventObject();
     $modelConfig = $subject->getModelService()->getParsedModelConfig($subject->getModelName());
     if (!(is_array($models) || $models instanceof ResultSetInterface)) {
         $models = [$models];
     }
     $aModels = [];
     foreach ($models as $_k => $aclModel) {
         if ($aclModel instanceof AclDataModel) {
             $mymodel = $aclModel->getDataModel();
         } else {
             $mymodel = $aclModel;
         }
         foreach ($modelConfig->joins as $_k => $join) {
             if ($join['type'] == 'lookup') {
                 $this->fillLookup($join, $subject, $mymodel);
             } elseif ($join['type'] == 'static_lookup') {
                 $this->fillStaticLookup($join, $subject, $mymodel);
             }
         }
         $aModels[] = $mymodel->getArrayCopy();
     }
     if ($models instanceof ResultSetInterface) {
         $models->initialize($aModels);
     }
     //        else
     //        {
     //            $models = $aModels;
     //        }
 }
開發者ID:modelframework,項目名稱:modelframework,代碼行數:34,代碼來源:FillJoinsObserver.php

示例2: update

 /**
  * @param \SplSubject|Logic $subject
  *
  * @throws \Exception
  */
 public function update(\SplSubject $subject)
 {
     $models = $subject->getEventObject();
     $fs = $subject->getFilesystemServiceVerify();
     foreach ($models as $id => $model) {
         $results[$id] = $fs->deleteFile($model->document());
     }
     return $results;
 }
開發者ID:modelframework,項目名稱:modelframework,代碼行數:14,代碼來源:RecycleObserver.php

示例3: update

 /**
  * @param \SplSubject|Logic $subject
  *
  * @throws \Exception
  */
 public function update(\SplSubject $subject)
 {
     $models = $subject->getEventObject();
     if (!(is_array($models) || $models instanceof ResultSetInterface)) {
         $models = [$models];
     }
     foreach ($models as $_k => $model) {
         if ($model instanceof AclDataModel) {
             $dataModel = $model->getDataModel();
         } else {
             $dataModel = $model;
         }
         $subject->getGatewayServiceVerify()->get($dataModel->getModelName())->delete(['_id' => $dataModel->id()]);
     }
 }
開發者ID:modelframework,項目名稱:modelframework,代碼行數:20,代碼來源:CleanObserver.php

示例4: update

 /**
  * @param \SplSubject|Logic $subject
  */
 public function update(\SplSubject $subject)
 {
     $model = $subject->getEventObject();
     $settings = $this->getRootConfig();
     if ($model->{$settings}['isdefault_field'] == 'true') {
         $gw = $subject->getGatewayServiceVerify()->get($model->getModelName());
         $searchQuery = [];
         foreach ($settings['unique_fields'] as $field) {
             $searchQuery[$field] = $model->{$field};
         }
         $searchQuery['-_id'] = $model->_id;
         $otherModels = $gw->find($searchQuery);
         foreach ($otherModels as $othrModel) {
             $othrModel->{$settings}['isdefault_field'] = 'false';
             $gw->save($othrModel);
         }
     }
 }
開發者ID:modelframework,項目名稱:modelframework,代碼行數:21,代碼來源:SetAsDefaultObserver.php


注:本文中的SplSubject::getEventObject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。