當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。