本文整理汇总了PHP中ColumnMap::setDefaultValue方法的典型用法代码示例。如果您正苦于以下问题:PHP ColumnMap::setDefaultValue方法的具体用法?PHP ColumnMap::setDefaultValue怎么用?PHP ColumnMap::setDefaultValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ColumnMap
的用法示例。
在下文中一共展示了ColumnMap::setDefaultValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addColumn
/**
* Add a column to the table.
*
* @param string name A String with the column name.
* @param string $type A string specifying the Propel type.
* @param boolean $isNotNull Whether column does not allow NULL values.
* @param int $size An int specifying the size.
* @param boolean $pk True if column is a primary key.
* @param string $fkTable A String with the foreign key table name.
* @param $fkColumn A String with the foreign key column name.
* @param string $defaultValue The default value for this column.
* @return ColumnMap The newly created column.
*/
public function addColumn($name, $phpName, $type, $isNotNull = false, $size = null, $defaultValue = null, $pk = false, $fkTable = null, $fkColumn = null)
{
$col = new ColumnMap($name, $this);
$col->setType($type);
$col->setSize($size);
$col->setPhpName($phpName);
$col->setNotNull($isNotNull);
$col->setDefaultValue($defaultValue);
if ($pk) {
$col->setPrimaryKey(true);
$this->primaryKeys[$name] = $col;
}
if ($fkTable && $fkColumn) {
$col->setForeignKey($fkTable, $fkColumn);
$this->foreignKeys[$name] = $col;
}
$this->columns[$name] = $col;
$this->columnsByPhpName[$phpName] = $col;
return $col;
}
示例2: addColumn
/**
* Add a column to the table.
*
* @param string name A String with the column name.
* @param string $type A string specifying the Propel type.
* @param boolean $isNotNull Whether column does not allow NULL values.
* @param int $size An int specifying the size.
* @param boolean $pk True if column is a primary key.
* @param string $fkTable A String with the foreign key table name.
* @param $fkColumn A String with the foreign key column name.
* @param string $defaultValue The default value for this column.
* @return ColumnMap The newly created column.
*/
public function addColumn($name, $phpName, $type, $isNotNull = false, $size = null, $defaultValue = null, $pk = false, $fkTable = null, $fkColumn = null)
{
$col = new ColumnMap($name, $this);
if ($fkTable && $fkColumn) {
if (strpos($fkColumn, '.') > 0 && strpos($fkColumn, $fkTable) !== false) {
$fkColumn = substr($fkColumn, strlen($fkTable) + 1);
}
$col->setForeignKey($fkTable, $fkColumn);
$this->foreignKeys[$name] = $col;
}
$col->setType($type);
$col->setSize($size);
$col->setPhpName($phpName);
$col->setNotNull($isNotNull);
$col->setDefaultValue($defaultValue);
if ($pk) {
$col->setPrimaryKey(true);
$this->primaryKeys[$name] = $col;
}
$this->columns[$name] = $col;
return $this->columns[$name];
}