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


PHP Combination::find方法代码示例

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


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

示例1: delete

 function delete($id = null)
 {
     if (!$id) {
         $this->Session->setFlash(__('Invalid id for Operatingsystem', true));
         $this->redirect(array('action' => 'index'));
     }
     if ($this->Operatingsystem->del($id)) {
         $combination = new Combination();
         $all_com = $combination->find('all', array('conditions' => array('Combination.operatingsystem_id' => $id)));
         foreach ($all_com as $key => $value) {
             $this->Operatingsystem->Combination->del($value['Combination']['id']);
         }
         $this->Session->setFlash(__('Operatingsystem deleted', true));
         $this->redirect(array('action' => 'index'));
     }
 }
开发者ID:erlendfh,项目名称:Bromine,代码行数:16,代码来源:operatingsystems_controller.php

示例2: retrieveParameter

 /**
  * Get the value for a core parameter, i.e. one that is not associated
  * with a specific Simulation (including those associated with the
  * choice and type of needles, as this is also specific to a Simulation)
  *
  * @param string $id Combination for which we wish to find a core parameter
  * @param string $name Parameter name to be retrieved
  * @return string Textual representation of value
  */
 public function retrieveParameter($id, $name)
 {
     $combination = Combination::find($id);
     if (empty($combination)) {
         return ["error" => "Combination not found"];
     }
     $parameter = $combination->retrieveParameter($name);
     if ($parameter) {
         return $parameter->Value;
     }
     return null;
 }
开发者ID:philtweir,项目名称:glossia-scratch-test-site,代码行数:21,代码来源:CombinationController.php

示例3: fromXml

 public static function fromXml($xml)
 {
     $xpath = new DOMXpath($xml);
     $simulation = new static();
     $simulationNode = $xpath->query('//simulationDefinition/simulation')->item(0);
     $simulation->Id = strtoupper($simulationNode->getAttribute('id'));
     $simulationAttributes = ['Caption', 'SegmentationType', 'Progress', 'State', 'Color', 'Active'];
     foreach ($simulationAttributes as $simulationAttribute) {
         $simulation->{$simulationAttribute} = $simulationNode->getAttribute(strtolower($simulationAttribute));
     }
     //if (Simulation::find($simulation->Id))
     //  return [false, "Simulation with this ID already exists"];
     $simulationNeedle = [];
     $combination = Combination::find($xpath->query('//simulationDefinition/combination/@id')->item(0)->value);
     if (!$combination) {
         throw new Exception("Cannot find combination (you may be able to work around this manually from the XML)");
     }
     $patient = DB::table('ItemSet_Patient')->where('Id', '=', $xpath->query('//simulationDefinition/simulation/patient/@id')->item(0)->value)->get();
     if (empty($patient)) {
         throw new Exception("Patient no longer exists");
     }
     $patient = $patient[0];
     $simulation->Combination_Id = $combination->Combination_Id;
     $simulation->Patient_Id = $patient->Id;
     $simulation->Id = null;
     $simulation->save();
     $parameterNodes = $xpath->query('//simulationDefinition/parameters/parameter');
     $parameters = [];
     foreach ($parameterNodes as $parameterNode) {
         $parameter = Parameter::whereName($parameterNode->getAttribute("name"))->first();
         $simulation->Parameters()->attach($parameter, ["ValueSet" => $parameterNode->getAttribute("value")]);
     }
     $needleNodes = $xpath->query('//simulationDefinition/numericalModel/needles/needle');
     foreach ($needleNodes as $needleNode) {
         $needle = Needle::find($needleNode->getAttribute("id"));
         if (!$needle) {
             throw new Exception("Needle not found");
         }
         $simulationNeedle = new SimulationNeedle();
         $simulationNeedle->Needle_Id = $needle->Id;
         $simulationNeedle->Simulation_Id = $simulation->Id;
         $simulationNeedle->save();
         $parameterNodes = $xpath->query('//simulationDefinition/numericalModel/needles/needle/parameters/parameter');
         $parameters = [];
         foreach ($parameterNodes as $parameterNode) {
             $parameter = Parameter::whereName($parameterNode->getAttribute("name"))->first();
             switch ($parameter->Name) {
                 case "NEEDLE_TIP_LOCATION":
                     $target = PointSet::fromArray(json_decode($parameterNode->getAttribute("value")));
                     $target->save();
                     $simulationNeedle->Target_Id = $target->Id;
                     break;
                 case "NEEDLE_ENTRY_LOCATION":
                     $entry = PointSet::fromArray(json_decode($parameterNode->getAttribute("value")));
                     $entry->save();
                     $simulationNeedle->Entry_Id = $entry->Id;
                     break;
                 default:
                     $simulationNeedle->Parameters()->attach($parameter, ["ValueSet" => $parameterNode->getAttribute("value")]);
             }
         }
         $simulationNeedle->save();
     }
     //foreach ($parameters as $sP)
     //{
     //  $sP->Simulation_Id = $simulation->Id;
     //  $sP->save();
     //}
     $simulation->save();
     return $simulation;
 }
开发者ID:philtweir,项目名称:glossia-scratch-test-site,代码行数:71,代码来源:Simulation.php

示例4: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $combination = Combination::find(Input::get('Combination_Id'));
     if (Config::get('gosmart.integrated_patient_database')) {
         $patient = DB::table('ItemSet_Patient')->whereId(Input::get('Patient_Id'))->first();
     }
     $caption = Input::get('caption');
     $incompatibilities = [];
     $userRequiredParameters = [];
     list($parameters, $needleParameters) = $combination->compileParameters(new Collection(), [], new Collection(), $incompatibilities, $userRequiredParameters);
     $simulation = new Simulation();
     $simulation->Combination_Id = $combination->Combination_Id;
     $simulation->Patient_Id = $patient->Id;
     $simulation->Caption = 'N: ' . $caption;
     $simulation->SegmentationType = 0;
     $simulation->Progress = '0';
     $simulation->State = 0;
     $simulation->Color = 0;
     $simulation->Active = 0;
     $simulation->save();
     foreach ($parameters as $parameter) {
         $simulation->parameters()->attach($parameter, ['ValueSet' => $parameter->Value]);
     }
     return Redirect::route('simulation.edit', $simulation->Id);
 }
开发者ID:philtweir,项目名称:glossia-scratch-test-site,代码行数:30,代码来源:SimulationController.php


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