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


PHP ActiveRecordModel::getOwner方法代码示例

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


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

示例1: setFormResponse

 public function setFormResponse(ActionResponse $response, Form $form, $prefix = '')
 {
     $specFields = $this->owner->getSpecification()->getSpecificationFieldSet(ActiveRecordModel::LOAD_REFERENCES);
     $specFieldArray = $specFields->toArray();
     // set select values
     $selectors = EavFieldCommon::getSelectorValueTypes();
     foreach ($specFields as $key => $field) {
         if (in_array($field->type->get(), $selectors)) {
             $values = $field->getValuesSet()->toArray();
             $specFieldArray[$key]['values'] = array('' => '');
             foreach ($values as $value) {
                 $specFieldArray[$key]['values'][$value['ID']] = isset($value['value_lang']) ? $value['value_lang'] : $value['value'];
             }
         }
     }
     // arrange SpecFields's into groups
     $specFieldsByGroup = array();
     $prevGroupID = -1;
     $groupClass = $this->getFieldClass() . 'Group';
     foreach ($specFieldArray as $field) {
         $groupID = isset($field[$groupClass]['ID']) ? $field[$groupClass]['ID'] : '';
         if ((int) $groupID && $prevGroupID != $groupID) {
             $prevGroupID = $groupID;
         }
         $specFieldsByGroup[$groupID][] = $field;
     }
     // get multi language spec fields
     $multiLingualSpecFields = array();
     foreach ($specFields as $key => $field) {
         if ($field->isTextField()) {
             $multiLingualSpecFields[] = $field->toArray();
         }
     }
     if (!$prefix) {
         $response->set("specFieldList", $specFieldsByGroup);
     }
     $response->set("groupClass", $groupClass);
     $response->set("multiLingualSpecFieldss", $multiLingualSpecFields);
     // set fields by prefix
     $prefixed = $response->get("specFieldList_prefix", array());
     $prefixed[$prefix] = $specFieldsByGroup;
     $response->set("specFieldList_prefix", $prefixed);
     $this->owner->load();
     // set fields by owner
     if ($this->owner instanceof EavObject && ($owner = $this->owner->getOwner())) {
         $byOwner = $response->get("specFieldListByOwner", array());
         $byOwner[get_class($owner)][$owner->getID()] = $specFieldsByGroup;
         $response->set("specFieldListByOwner", $byOwner);
     }
     $form->setData($this->getFormData($prefix));
     //$this->setFormValidator($form->getValidator());
 }
开发者ID:saiber,项目名称:www,代码行数:52,代码来源:EavSpecificationManagerCommon.php


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