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


PHP ModelCriteria::getAsColumns方法代码示例

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


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

示例1: addQueryColumns

 protected function addQueryColumns()
 {
     $tableMap = $this->query->getTableMap();
     foreach ($tableMap->getColumns() as $column) {
         if ($column->isForeignKey()) {
             continue;
         }
         $name = strtolower($column->getName());
         $this->addColumn($name, array('hide' => $column->isPrimaryKey(), 'phpName' => $column->getPhpName(), 'action' => $column->isPrimaryString() ? 'edit' : null));
     }
     // add virtual columns
     foreach ($this->query->getAsColumns() as $colName => $clause) {
         $this->addColumn($colName, array('phpName' => $colName));
     }
     $behaviors = $tableMap->getBehaviors();
     if (array_key_exists('sortable', $behaviors)) {
         $rankCol = strtolower($behaviors['sortable']['rank_column']);
         if (isset($this->columns[$rankCol])) {
             $this->addColumn($rankCol, array('hide' => true));
             $this->setOptions(array('defaultSortColumn' => $rankCol));
         }
         $this->setOptions(array('sortable' => array($this, 'sortItems')));
     }
     $i18nTableName = $this->getI18nTableName($tableMap);
     if ($i18nTableName !== null && $this->query->getJoin($i18nTableName) !== null) {
         $i18nTableMap = \PropelQuery::from($i18nTableName)->getTableMap();
         foreach ($i18nTableMap->getColumns() as $column) {
             if ($column->isPrimaryKey()) {
                 continue;
             }
             $this->addColumn(strtolower($column->getName()), array('sortCallback' => array($this, 'sortI18nColumn'), 'phpName' => $column->getPhpName()));
         }
     }
 }
开发者ID:bombayworks,项目名称:currycms,代码行数:34,代码来源:ListView.php

示例2: init

 /**
  * Define the hydration schema based on a query object.
  * Fills the Formatter's properties using a Criteria as source
  *
  * @param ModelCriteria $criteria
  *
  * @return PropelFormatter The current formatter object
  */
 public function init(ModelCriteria $criteria)
 {
     $this->dbName = $criteria->getDbName();
     $this->setClass($criteria->getModelName());
     $this->setWith($criteria->getWith());
     $this->asColumns = $criteria->getAsColumns();
     $this->hasLimit = $criteria->getLimit() != 0;
     return $this;
 }
开发者ID:rodolfobais,项目名称:proylectura,代码行数:17,代码来源:PropelFormatter.php

示例3: getRow

 /**
  * Get row properties.
  *
  * @param BaseObject $obj
  * @return array
  */
 protected function getRow($obj)
 {
     $columnToPhpName = array();
     foreach ($this->tableMap->getColumns() as $name => $column) {
         $columnToPhpName[strtolower($name)] = $column->getPhpName();
     }
     $celldata = array();
     foreach ($this->columns as $column => $opts) {
         if (isset($this->callbacks[$column])) {
             $value = call_user_func($this->callbacks[$column], $obj);
         } else {
             try {
                 if (isset($columnToPhpName[$column])) {
                     $phpName = $columnToPhpName[$column];
                 } else {
                     $tmp = $this->query->getAsColumns();
                     if (isset($tmp[$column])) {
                         $phpName = $column;
                     }
                 }
                 $value = $obj->{'get' . $phpName}();
             } catch (Exception $e) {
                 throw new Exception("Unable to fetch value from column '{$column}'.");
             }
         }
         if (is_null($value)) {
             $value = 'Ø';
         } else {
             if (is_bool($value)) {
                 $value = $value ? 'true' : 'false';
             } else {
                 if (is_array($value)) {
                     $value = join(', ', $value);
                 }
             }
         }
         $escape = !isset($opts['escape']) ? true : (bool) $opts['escape'];
         $value = str_replace(PHP_EOL, "", $value);
         $celldata[] = $escape ? htmlspecialchars($value) : $value;
     }
     return array("id" => "_" . $obj->getPrimaryKey(), "cell" => $celldata);
 }
开发者ID:varvanin,项目名称:currycms,代码行数:48,代码来源:Propel.php


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