当前位置: 首页>>代码示例>>PHP>>正文


PHP RuleAction::setData方法代码示例

本文整理汇总了PHP中RuleAction::setData方法的典型用法代码示例。如果您正苦于以下问题:PHP RuleAction::setData方法的具体用法?PHP RuleAction::setData怎么用?PHP RuleAction::setData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RuleAction的用法示例。


在下文中一共展示了RuleAction::setData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: loadEntities

 protected function loadEntities($simulator, $datasources)
 {
     foreach ($datasources->DataSource as $datasource) {
         $datasourceObj = new DataSource($this, (int) $datasource['id'], (string) $datasource['name'], (string) $datasource['type']);
         $datasourceObj->setUri((string) $datasource['uri']);
         $datasourceObj->setMethod((string) $datasource['method']);
         $datasourceObj->setDatabase((int) $datasource['database']);
         $datasourceObj->setDescription((string) $datasource->Description);
         foreach ($datasource->Namespace as $namespace) {
             $datasourceObj->addNamespace((string) $namespace['prefix'], (string) $namespace['uri']);
         }
         $this->datasources[] = $datasourceObj;
     }
     if ($datasources->Databases) {
         foreach ($datasources->Databases->Database as $database) {
             $databaseObj = new Database($this, (int) $database['id'], (string) $database['type'], (string) $database['name']);
             $databaseObj->setLabel((string) $database['label']);
             $databaseObj->setHost((string) $database['host']);
             $databaseObj->setPort((int) $database['port']);
             $databaseObj->setUser((string) $database['user']);
             if ((string) $database['password'] != '') {
                 $databaseObj->setPassword((string) $database['password']);
             } elseif ((string) $database['user'] != '') {
                 try {
                     $user = $this->controller->get('kernel')->getContainer()->getParameter('database_user');
                     if ((string) $database['user'] == $user) {
                         $databaseObj->setPassword($this->controller->get('kernel')->getContainer()->getParameter('database_password'));
                     }
                 } catch (\Exception $e) {
                 }
             }
             $this->databases[] = $databaseObj;
         }
     }
     $this->setName((string) $simulator["name"]);
     $this->setLabel((string) $simulator["label"]);
     $this->setDefaultView((string) $simulator["defaultView"]);
     $this->setReferer((string) $simulator["referer"]);
     $this->setDynamic((string) $simulator['dynamic'] == '1');
     $this->setMemo((string) $simulator['memo'] == '1');
     $this->setDescription((string) $simulator->Description);
     $this->setRelatedInformations($simulator->RelatedInformations);
     $this->setDateFormat((string) $simulator->DataSet['dateFormat']);
     $this->setDecimalPoint((string) $simulator->DataSet['decimalPoint']);
     $this->setMoneySymbol((string) $simulator->DataSet['moneySymbol']);
     $this->setSymbolPosition((string) $simulator->DataSet['symbolPosition']);
     if ($simulator->DataSet) {
         foreach ($simulator->DataSet->children() as $child) {
             if ($child->getName() == "DataGroup") {
                 $datagroup = $child;
                 $dataGroupObj = new DataGroup($this, (int) $datagroup['id'], (string) $datagroup['name']);
                 $dataGroupObj->setLabel((string) $datagroup['label']);
                 $dataGroupObj->setDescription((string) $datagroup->Description);
                 foreach ($datagroup->Data as $data) {
                     $dataGroupObj->addData($this->loadData($data));
                 }
                 $this->datas[] = $dataGroupObj;
             } elseif ($child->getName() == "Data") {
                 $this->datas[] = $this->loadData($child);
             }
         }
     }
     if ($simulator->Profiles) {
         $this->profiles = new Profiles($this);
         $this->profiles->setLabel((string) $simulator->Profiles['label']);
         foreach ($simulator->Profiles->Profile as $profile) {
             $profileObj = new Profile((int) $profile['id'], (string) $profile['name']);
             $profileObj->setLabel((string) $profile['label']);
             $profileObj->setDescription((string) $profile->Description);
             foreach ($profile->Data as $data) {
                 $profileObj->addData((int) $data['id'], (string) $data['default']);
             }
             $this->profiles->addProfile($profileObj);
         }
     }
     if ($simulator->Steps) {
         $step0 = false;
         foreach ($simulator->Steps->Step as $step) {
             $stepObj = new Step($this, (int) $step['id'], (string) $step['name'], (string) $step['label'], (string) $step['template']);
             if ($stepObj->getId() == 0) {
                 $step0 = true;
             }
             $stepObj->setOutput((string) $step['output']);
             $stepObj->setDescription((string) $step->Description);
             $stepObj->setDynamic((string) $step['dynamic'] == '1');
             foreach ($step->Panels->Panel as $panel) {
                 $panelObj = new Panel($stepObj, (int) $panel['id']);
                 $panelObj->setName((string) $panel['name']);
                 $panelObj->setLabel((string) $panel['label']);
                 foreach ($panel->children() as $block) {
                     if ($block->getName() == "FieldSet") {
                         $fieldset = $block;
                         $fieldsetObj = new FieldSet($panelObj, (int) $fieldset['id']);
                         $fieldsetObj->setLegend((string) $fieldset->Legend);
                         if ((string) $fieldset['disposition'] != "") {
                             $fieldsetObj->setDisposition((string) $fieldset['disposition']);
                         }
                         if ((string) $fieldset['display'] != "") {
                             $fieldsetObj->setDisplay((string) $fieldset['display']);
                         }
//.........这里部分代码省略.........
开发者ID:eureka2,项目名称:g6k,代码行数:101,代码来源:Simulator.php


注:本文中的RuleAction::setData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。