本文整理汇总了PHP中Doctrine\DBAL\Schema\Column::getCustomSchemaOption方法的典型用法代码示例。如果您正苦于以下问题:PHP Column::getCustomSchemaOption方法的具体用法?PHP Column::getCustomSchemaOption怎么用?PHP Column::getCustomSchemaOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\DBAL\Schema\Column
的用法示例。
在下文中一共展示了Column::getCustomSchemaOption方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAddColumnSQL
/**
* @param string $tableName
* @param string $columnName
* @param \Doctrine\DBAL\Schema\Column $column
* @return array
*/
protected function getAddColumnSQL($tableName, $columnName, Column $column)
{
$query = array();
$spatial = array('srid' => 4326, 'dimension' => 2, 'index' => false);
foreach ($spatial as $key => &$val) {
if ($column->hasCustomSchemaOption('spatial_' . $key)) {
$val = $column->getCustomSchemaOption('spatial_' . $key);
}
}
// Geometry columns are created by AddGeometryColumn stored procedure
$query[] = sprintf("SELECT AddGeometryColumn('%s', '%s', %d, '%s', %d)", $tableName, $columnName, $spatial['srid'], strtoupper($column->getType()->getName()), $spatial['dimension']);
if ($spatial['index']) {
// Add a spatial index to the field
$query[] = sprintf("Select CreateSpatialIndex('%s', '%s')", $tableName, $columnName);
}
return $query;
}
示例2: getAddColumnSQL
/**
* @param string $tableName
* @param string $columnName
* @param \Doctrine\DBAL\Schema\Column $column
* @return array
*/
protected function getAddColumnSQL($tableName, $columnName, Column $column)
{
$query = array();
$spatial = array('srid' => 4326, 'dimension' => 2, 'index' => false);
foreach ($spatial as $key => &$val) {
if ($column->hasCustomSchemaOption('spatial_' . $key)) {
$val = $column->getCustomSchemaOption('spatial_' . $key);
}
}
// Geometry columns are created by AddGeometryColumn stored procedure
$query[] = sprintf("SELECT AddGeometryColumn('%s', '%s', %d, '%s', %d)", $tableName, $columnName, $spatial['srid'], strtoupper($column->getType()->getName()), $spatial['dimension']);
if ($spatial['index']) {
// Add a spatial index to the field
$indexName = $this->generateIndexName($tableName, $columnName);
$query[] = sprintf("CREATE INDEX %s ON %s USING GIST (%s)", $indexName, $tableName, $columnName);
}
if ($column->getNotnull()) {
// Add a NOT NULL constraint to the field
$query[] = sprintf("ALTER TABLE %s ALTER %s SET NOT NULL", $tableName, $columnName);
}
return $query;
}