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


PHP Admin::getTableForClass方法代码示例

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


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

示例1: displayList

 /** inheritdoc */
 public static function displayList($value, $edit_link, &$settings, &$model)
 {
     $target_class = $settings['mapping']['targetEntity'];
     $target_table = \Admin::getTableForClass($target_class);
     if ($value instanceof \Doctrine\Common\Collections\Collection && count($value) > 0) {
         return \Html::anchor("/admin/{$target_table}", count($value) . ' »');
     } else {
         return '0';
     }
 }
开发者ID:soundintheory,项目名称:fuel-cmf,代码行数:11,代码来源:Multiselect.php

示例2: displayList

 /** inheritdoc */
 public static function displayList($value, $edit_link, &$settings, &$model)
 {
     $target_class = $settings['mapping']['targetEntity'];
     $target_table = \Admin::getTableForClass($target_class);
     if ($value instanceof \Doctrine\Common\Collections\Collection && count($value) > 0) {
         $values = $value->toArray();
         $output = '';
         foreach ($values as $val) {
             $output .= \Html::anchor("/admin/{$target_table}/" . $val->id . "/edit", $val->display()) . ', ';
         }
         return rtrim($output, ', ');
     } else {
         return '-';
     }
 }
开发者ID:soundintheory,项目名称:fuel-cmf,代码行数:16,代码来源:Checkbox.php

示例3: processItem

 protected function processItem(&$entity, $delete = false)
 {
     if (!empty($entity)) {
         if (!empty($entity->settings) && isset($entity->settings['original_id']) && $entity->settings['original_id'] > 0) {
             $tableName = \Admin::getTableForClass($entity->getEntityClass());
             if (empty($this->jsonObject)) {
                 $this->jsonObject = new \stdClass();
                 $this->jsonObject->data = new \stdClass();
             }
             if (empty($this->jsonObject->data->{$tableName})) {
                 $this->jsonObject->data->{$tableName} = array();
             }
             $object = $entity->jsonLanguageDataObject($delete);
             if (!in_array($object, $this->jsonObject->data->{$tableName})) {
                 $this->jsonObject->data->{$tableName}[] = $object;
             }
         }
     }
 }
开发者ID:soundintheory,项目名称:fuel-cmf,代码行数:19,代码来源:Canonicallistener.php

示例4: buildSingleResult

 protected function buildSingleResult($entity, &$results)
 {
     $root_type = $this->root;
     // Get metadata for this result
     $resultClass = get_class($entity);
     $resultMeta = $resultClass::metadata();
     $resultClass = $resultMeta->name;
     $field_list = $this->getFieldsForModel($resultClass);
     $associations = array_intersect($field_list, $resultMeta->getAssociationNames());
     $fields = array_intersect($field_list, $resultMeta->getFieldNames());
     $entity->__original_url_canonical = !empty($entity->url) && $entity->url instanceof \CMF\Model\URL ? rtrim(\Uri::base(false), '/') . '/' . ltrim($entity->url->url, '/') : "";
     // Create a simple array version of the result
     $output = $entity->toArray($fields);
     $output_type = $resultMeta->name;
     $output_id = $entity->id;
     $this->addDiscriminator($entity, $output);
     // Put the associations into their respective sideloaded arrays
     foreach ($associations as $assoc) {
         $assoc_class = $resultMeta->getAssociationTargetClass($assoc);
         $type = \Inflector::pluralize(\Admin::getTableForClass($assoc_class));
         if (!isset($this->output['included'][$type])) {
             $this->output['included'][$type] = array();
         }
         if ($resultMeta->isCollectionValuedAssociation($assoc)) {
             $output[$assoc] = array('ids' => array(), 'type' => $type, 'href' => \Uri::base(false) . "api/{$root_type}/{$output_id}/{$assoc}");
             if (empty($entity->{$assoc})) {
                 continue;
             }
             foreach ($entity->{$assoc} as $assoc_value) {
                 $assoc_id = $assoc_value->id;
                 $output[$assoc]['ids'][] = $assoc_id;
                 if (!isset($this->output['included'][$type][$assoc_id]) && !($type == $this->root && (isset($this->output[$this->rootOutput][$assoc_id]) || $this->entityInResultSet($assoc_value, $results)))) {
                     $this->output['included'][$type][$assoc_id] = array();
                     $this->output['included'][$type][$assoc_id] = $this->buildSingleResult($assoc_value, $results);
                 }
             }
         } else {
             if (empty($entity->{$assoc})) {
                 $output[$assoc] = null;
                 continue;
             }
             $assoc_id = $entity->{$assoc}->id;
             $output[$assoc] = array('id' => $assoc_id, 'type' => $type, 'href' => \Uri::base(false) . "api/{$type}/{$assoc_id}");
             if (!isset($this->output['included'][$type][$assoc_id]) && !($type == $this->root && (isset($this->output[$this->rootOutput][$assoc_id]) || $this->entityInResultSet($entity->{$assoc}, $results)))) {
                 $this->output['included'][$type][$assoc_id] = array();
                 $this->output['included'][$type][$assoc_id] = $this->buildSingleResult($entity->{$assoc}, $results);
             }
         }
     }
     return $output;
 }
开发者ID:soundintheory,项目名称:fuel-cmf,代码行数:51,代码来源:query.php

示例5: importType

 /**
  * @see \CMF\Model\Base::$_import_type
  * @return string
  */
 public static function importType()
 {
     $called_class = get_called_class();
     if (empty($called_class::$_import_type)) {
         return \Admin::getTableForClass($called_class);
     }
     return $called_class::$_import_type;
 }
开发者ID:soundintheory,项目名称:fuel-cmf,代码行数:12,代码来源:Base.php


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