本文整理汇总了PHP中Propel\Generator\Model\Column::getTableMapName方法的典型用法代码示例。如果您正苦于以下问题:PHP Column::getTableMapName方法的具体用法?PHP Column::getTableMapName怎么用?PHP Column::getTableMapName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Propel\Generator\Model\Column
的用法示例。
在下文中一共展示了Column::getTableMapName方法的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());
}