本文整理汇总了PHP中Column::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP Column::setName方法的具体用法?PHP Column::setName怎么用?PHP Column::setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Column
的用法示例。
在下文中一共展示了Column::setName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInternalColumns
protected function getInternalColumns()
{
if (is_null($this->columns)) {
$this->columns = array();
$keyLength = $this->getKeyLength();
if (is_null($keyLength)) {
throw new ErrorException("Cannot create meta-table-schema for indicies when no key-length is specified!");
}
$columnPage = new Column();
for ($i = 1; $i <= 33; $i++) {
$columnPage->setName("ref{$i}");
$columnPage->setDataType(DataType::INT());
$columnPage->setLength($keyLength);
$columnPage->setExtraFlags(Column::EXTRA_PRIMARY_KEY);
$this->columns[] = clone $columnPage;
$columnPage->setName("val{$i}");
$columnPage->setDataType(DataType::INT());
$columnPage->setLength($keyLength);
$columnPage->setExtraFlags(Column::EXTRA_PRIMARY_KEY);
$this->columns[] = clone $columnPage;
$columnPage->setName("row{$i}");
$columnPage->setDataType(DataType::INT());
$columnPage->setLength($keyLength);
$columnPage->setExtraFlags(Column::EXTRA_PRIMARY_KEY);
$this->columns[] = clone $columnPage;
}
}
return $this->columns;
}
示例2: testMakeList
/**
* Tests static Column::makeList() method.
* @deprecated - Column::makeList() is deprecated and set to be removed in 1.3
*/
public function testMakeList()
{
$expected = '"Column0", "Column1", "Column2", "Column3", "Column4"';
$objArray = array();
for ($i = 0; $i < 5; $i++) {
$c = new Column();
$c->setName("Column" . $i);
$objArray[] = $c;
}
$list = Column::makeList($objArray, new DefaultPlatform());
$this->assertEquals($expected, $list, sprintf("Expected '%s' match, got '%s' ", var_export($expected, true), var_export($list, true)));
$strArray = array();
for ($i = 0; $i < 5; $i++) {
$strArray[] = "Column" . $i;
}
$list = Column::makeList($strArray, new DefaultPlatform());
$this->assertEquals($expected, $list, sprintf("Expected '%s' match, got '%s' ", var_export($expected, true), var_export($list, true)));
}
示例3: setColumns
/**
* Creates the column from a given array
*
* @param array $columns
*/
public function setColumns($columns)
{
if (false == is_array($columns)) {
return;
}
foreach ($columns as $name => $options) {
$column = new Column();
$type = $this->getOptionByKey("type", $options);
$length = $this->getOptionByKey("length", $options);
$notNull = $this->getOptionByKey("notNull", $options);
$autoIncrement = $this->getOptionByKey("autoIncrement", $options);
$index = $this->getOptionByKey("index", $options);
$collate = $this->getOptionByKey("collate", $options);
$column->setName($name);
// Set all options if set
if (false != $type) {
$column->setType($type);
}
if (false != $length) {
$column->setLength($length);
}
if (false != $notNull) {
$column->setNotNull($notNull);
}
if (false != $autoIncrement) {
$column->setAutoIncrement($autoIncrement);
}
if (false != $index) {
$column->setIndex($index);
}
if (false != $collate) {
$column->setCollate($collate);
}
// Add column
$this->columns[] = $column;
}
}
示例4: testColumnIsFKAndPK
public function testColumnIsFKAndPK()
{
$column = new Column();
$column->setName('id');
$column->setPrimaryKey(true);
$column->setAutoIncrement(true);
$column->setType('integer');
$table = new Table();
$table->setCommonName('table_one');
$table->addColumn($column);
$db = new Database();
$db->setName('MultipleTables');
$db->addTable($table);
$column = new Column();
$column->setName('id');
$column->setPrimaryKey(true);
$column->setAutoIncrement(true);
$column->setType('integer');
$c2 = new Column();
$c2->setPrimaryKey(true);
$c2->setName('foreign_id');
$c2->setType('integer');
$table = new Table();
$table->setCommonName('table_two');
$table->addColumn($column);
$table->addColumn($c2);
$fk = new ForeignKey();
$fk->setName('FK_1');
$fk->addReference('foreign_id', 'id');
$fk->setForeignTableCommonName('table_one');
$table->addForeignKey($fk);
$db->addTable($table);
$expected = implode("\n", array('digraph G {', 'nodetable_one [label="{<table>table_one|<cols>id (integer) [PK]\\l}", shape=record];', 'nodetable_two [label="{<table>table_two|<cols>id (integer) [PK]\\lforeign_id (integer) [FK] [PK]\\l}", shape=record];', 'nodetable_two:cols -> nodetable_one:table [label="foreign_id=id"];', '}', ''));
$this->assertEquals($expected, PropelDotGenerator::create($db));
}
示例5: providerForTestGetModifyColumnRemoveDefaultValueDDL
public function providerForTestGetModifyColumnRemoveDefaultValueDDL()
{
$t1 = new Table('test');
$c1 = new Column();
$c1->setName('test');
$c1->getDomain()->setType('INTEGER');
$c1->setDefaultValue(0);
$t1->addColumn($c1);
$t2 = new Table('test');
$c2 = new Column();
$c2->setName('test');
$c2->getDomain()->setType('INTEGER');
$t2->addColumn($c2);
return array(array(PropelColumnComparator::computeDiff($c1, $c2)));
}
示例6: addColumn
/**
* @param string $name
* @param null|string $label
* @param null|string $width
* @param null|int $truncate
* @return Column
* @throws DuplicateColumnException
* @return \Nifty\Grid\Column
*/
protected function addColumn($name, $label = NULL, $width = NULL, $truncate = NULL)
{
if (!empty($this['columns']->components[$name])) {
throw new DuplicateColumnException("Column {$name} already exists.");
}
$column = new Column($this['columns'], $name);
$column->setName($name)->setLabel($label)->setWidth($width)->setTruncate($truncate)->injectParent($this);
return $column;
}
示例7: getInternalColumns
protected function getInternalColumns()
{
$columns = array();
$columnPage = new Column();
$columnPage->setName("TABLE_CATALOG");
$columnPage->setDataType(DataType::VARCHAR());
$columnPage->setLength(512);
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("TABLE_SCHEMA");
$columnPage->setDataType(DataType::VARCHAR());
$columnPage->setLength(64);
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("TABLE_NAME");
$columnPage->setDataType(DataType::VARCHAR());
$columnPage->setLength(64);
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("TABLE_TYPE");
$columnPage->setDataType(DataType::VARCHAR());
$columnPage->setLength(64);
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("ENGINE");
$columnPage->setDataType(DataType::VARCHAR());
$columnPage->setLength(64);
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("VERSION");
$columnPage->setDataType(DataType::BIGINT());
$columnPage->setLength(21);
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("ROW_FORMAT");
$columnPage->setDataType(DataType::VARCHAR());
$columnPage->setLength(10);
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("TABLE_ROWS");
$columnPage->setDataType(DataType::BIGINT());
$columnPage->setLength(21);
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("AVG_ROW_LENGTH");
$columnPage->setDataType(DataType::BIGINT());
$columnPage->setLength(21);
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("DATA_LENGTH");
$columnPage->setDataType(DataType::BIGINT());
$columnPage->setLength(21);
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("MAX_DATA_LENGTH");
$columnPage->setDataType(DataType::BIGINT());
$columnPage->setLength(21);
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("INDEX_LENGTH");
$columnPage->setDataType(DataType::BIGINT());
$columnPage->setLength(21);
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("DATA_FREE");
$columnPage->setDataType(DataType::BIGINT());
$columnPage->setLength(21);
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("AUTO_INCREMENT");
$columnPage->setDataType(DataType::BIGINT());
$columnPage->setLength(21);
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("CREATE_TIME");
$columnPage->setDataType(DataType::DATETIME());
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("UPDATE_TIME");
$columnPage->setDataType(DataType::DATETIME());
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("CHECK_TIME");
$columnPage->setDataType(DataType::DATETIME());
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("TABLE_COLLATION");
$columnPage->setDataType(DataType::VARCHAR());
$columnPage->setLength(32);
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("CHECKSUM");
$columnPage->setDataType(DataType::BIGINT());
$columnPage->setLength(21);
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("CREATE_OPTIONS");
$columnPage->setDataType(DataType::VARCHAR());
$columnPage->setLength(32);
$columns[$columnPage->getName()] = clone $columnPage;
$columnPage->setName("TABLE_COMMENT");
$columnPage->setDataType(DataType::VARCHAR());
$columnPage->setLength(32);
$columns[$columnPage->getName()] = clone $columnPage;
return $columns;
}