本文整理匯總了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;
}
示例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());
}