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


PHP Column::getConstantName方法代码示例

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


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

示例1: getColumnConstant

 /**
  * Get the column constant name (e.g. TableMapName::COLUMN_NAME).
  *
  * @param Column $col       The column we need a name for.
  * @param string $classname The TableMap classname to use.
  *
  * @return string If $classname is provided, then will return $classname::COLUMN_NAME; if not, then the TableMapName is looked up for current table to yield $currTableTableMap::COLUMN_NAME.
  */
 public function getColumnConstant($col, $classname = null)
 {
     if (null === $col) {
         throw new InvalidArgumentException('No columns were specified.');
     }
     if (null === $classname) {
         return $this->getBuildProperty('classPrefix') . $col->getConstantName();
     }
     // was it overridden in schema.xml ?
     if ($col->getTableMapName()) {
         $const = strtoupper($col->getTableMapName());
     } else {
         $const = strtoupper($col->getName());
     }
     return $classname . '::' . $const;
 }
开发者ID:robin850,项目名称:Propel2,代码行数:24,代码来源:AbstractOMBuilder.php

示例2: testGetConstantName

 public function testGetConstantName()
 {
     $table = $this->getTableMock('article');
     $table->expects($this->once())->method('getPhpName')->will($this->returnValue('Article'));
     $column = new Column('created_at');
     $column->setTable($table);
     $column->setTableMapName('created_at');
     $this->assertSame('created_at', $column->getTableMapName());
     $this->assertSame('COL_CREATED_AT', $column->getConstantName());
     $this->assertSame('ArticleTableMap::COL_CREATED_AT', $column->getFQConstantName());
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:11,代码来源:ColumnTest.php


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