当前位置: 首页>>代码示例>>PHP>>正文


PHP Column类代码示例

本文整理汇总了PHP中Column的典型用法代码示例。如果您正苦于以下问题:PHP Column类的具体用法?PHP Column怎么用?PHP Column使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Column类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setDefaultSortColumn

 public function setDefaultSortColumn(Column $col, $direction = false)
 {
     if ($direction != false) {
         $col->setColumnDefaultSortDirection($direction);
     }
     $this->defaultSortColumn = $col;
 }
开发者ID:digideskio,项目名称:concrete5,代码行数:7,代码来源:Set.php

示例2: removeSubColumn

 public function removeSubColumn(Column $column)
 {
     $this->subColumns = array_values(array_filter($this->subColumns, function ($elm) use($column) {
         return $elm->getName() !== $column->getName();
     }));
     return $this;
 }
开发者ID:brodaproject,项目名称:broda,代码行数:7,代码来源:Column.php

示例3: create_column

 public function create_column(&$column)
 {
     $c = new Column();
     $c->inflected_name = Inflector::instance()->variablize($column['field']);
     $c->name = $column['field'];
     $c->nullable = $column['null'] === 'YES' ? true : false;
     $c->pk = $column['key'] === 'PRI' ? true : false;
     $c->auto_increment = $column['extra'] === 'auto_increment' ? true : false;
     if ($column['type'] == 'timestamp' || $column['type'] == 'datetime') {
         $c->raw_type = 'datetime';
         $c->length = 19;
     } elseif ($column['type'] == 'date') {
         $c->raw_type = 'date';
         $c->length = 10;
     } else {
         preg_match('/^([A-Za-z0-9_]+)(\\(([0-9]+(,[0-9]+)?)\\))?/', $column['type'], $matches);
         $c->raw_type = count($matches) > 0 ? $matches[1] : $column['type'];
         if (count($matches) >= 4) {
             $c->length = intval($matches[3]);
         }
     }
     $c->map_raw_type();
     $c->default = $c->cast($column['default']);
     return $c;
 }
开发者ID:469306621,项目名称:Languages,代码行数:25,代码来源:MysqlAdapter.php

示例4: addColumns

 /**
  * Adds Columns to the specified table.
  *
  * @param      Table $table The Table model class to add columns to.
  */
 protected function addColumns(Table $table)
 {
     $stmt = $this->dbh->query("sp_columns '" . $table->getName() . "'");
     while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
         $name = $row['COLUMN_NAME'];
         $type = $row['TYPE_NAME'];
         $size = $row['LENGTH'];
         $is_nullable = $row['NULLABLE'];
         $default = $row['COLUMN_DEF'];
         $precision = $row['PRECISION'];
         $scale = $row['SCALE'];
         $autoincrement = false;
         if (strtolower($type) == "int identity") {
             $autoincrement = true;
         }
         $propelType = $this->getMappedPropelType($type);
         if (!$propelType) {
             $propelType = Column::DEFAULT_TYPE;
             $this->warn("Column [" . $table->getName() . "." . $name . "] has a column type (" . $type . ") that Propel does not support.");
         }
         $column = new Column($name);
         $column->setTable($table);
         $column->setDomainForType($propelType);
         // We may want to provide an option to include this:
         // $column->getDomain()->replaceSqlType($type);
         $column->getDomain()->replaceSize($size);
         $column->getDomain()->replaceScale($scale);
         if ($default !== null) {
             $column->getDomain()->setDefaultValue(new ColumnDefaultValue($default, ColumnDefaultValue::TYPE_VALUE));
         }
         $column->setAutoIncrement($autoincrement);
         $column->setNotNull(!$is_nullable);
         $table->addColumn($column);
     }
 }
开发者ID:RadioCampusFrance,项目名称:airtime,代码行数:40,代码来源:MssqlSchemaParser.php

示例5: populateFromOptions

 protected function populateFromOptions($options)
 {
     foreach ($options as $name => $attrs) {
         $column = new Column($name);
         if (isset($attrs['field'])) {
             $column->setFieldName($attrs['field']);
         }
         if (isset($attrs['type'])) {
             $column->setType($attrs['type']);
         }
         if (isset($attrs['sortable'])) {
             $column->setSortable($attrs['sortable']);
         }
         if (isset($attrs['label'])) {
             $column->setLabel($attrs['label']);
         }
         if (isset($attrs['format'])) {
             $column->setFormat($attrs['format']);
         }
         if (isset($attrs['format_function'])) {
             $column->setFormatFunction($attrs['format_function']);
         }
         if (isset($attrs['template'])) {
             $column->setTemplate($attrs['template']);
         }
         if (isset($attrs['boolean_actions'])) {
             $column->setBooleanActions($attrs['boolean_actions']);
         }
         if (isset($attrs['get_methods'])) {
             $column->setMethods($attrs['get_methods']);
         }
         $this->add($column);
     }
 }
开发者ID:senthilkumar3282,项目名称:LyraAdminBundle,代码行数:34,代码来源:ColumnCollection.php

示例6: createColumn

 public function createColumn(&$column)
 {
     $c = new Column();
     $c->inflectedName = Inflector::instance()->variablize($column['field']);
     $c->name = $column['field'];
     $c->nullable = $column['not_nullable'] ? false : true;
     $c->pk = $column['pk'] ? true : false;
     $c->autoIncrement = false;
     if (substr($column['type'], 0, 9) == 'timestamp') {
         $c->rawType = 'datetime';
         $c->length = 19;
     } elseif ($column['type'] == 'date') {
         $c->rawType = 'date';
         $c->length = 10;
     } else {
         preg_match('/^([A-Za-z0-9_]+)(\\(([0-9]+(,[0-9]+)?)\\))?/', $column['type'], $matches);
         $c->rawType = count($matches) > 0 ? $matches[1] : $column['type'];
         $c->length = count($matches) >= 4 ? intval($matches[3]) : intval($column['attlen']);
         if ($c->length < 0) {
             $c->length = null;
         }
     }
     $c->mapRawType();
     if ($column['default']) {
         preg_match('/^nextval\\(\'(.*)\'\\)$/', $column['default'], $matches);
         if (count($matches) == 2) {
             $c->sequence = $matches[1];
         } else {
             $c->default = $c->cast($column['default'], $this);
         }
     }
     return $c;
 }
开发者ID:ruri,项目名称:php-activerecord-camelcased,代码行数:33,代码来源:PgsqlAdapter.php

示例7: testReplaceColumnWithoutReplacement

 public function testReplaceColumnWithoutReplacement()
 {
     $xml = '<?xml version="1.0" ?>
             <column name="test" dump="replace" />';
     $xmlElement = new \SimpleXMLElement($xml);
     $columnConfig = new Column($xmlElement);
     $this->assertEquals('', $columnConfig->processRowValue('test value'));
 }
开发者ID:webfactory,项目名称:slimdump,代码行数:8,代码来源:ColumnTest.php

示例8: createEnumColumn

 public function createEnumColumn($defaultValues, $defaultValue)
 {
     $column = new Column();
     $column->setType(PropelTypes::ENUM);
     $column->setValueSet($defaultValues);
     $column->setDefaultValue($defaultValue);
     return $column;
 }
开发者ID:ketheriel,项目名称:ETVA,代码行数:8,代码来源:DefaultPlatformTest.php

示例9: columnName

 /**
  * 
  * @return database.model.Column
  */
 function columnName()
 {
     if (!Rhaco::isVariable("_R_D_C_", "Category::Name")) {
         $column = new Column("column=name,variable=name,type=string,size=30,require=true,", __CLASS__);
         $column->label(Message::_("name"));
         Rhaco::addVariable("_R_D_C_", $column, "Category::Name");
     }
     return Rhaco::getVariable("_R_D_C_", null, "Category::Name");
 }
开发者ID:riaf,项目名称:concert,代码行数:13,代码来源:CategoryTable.php

示例10: add_column

 public function add_column($name, $cfg)
 {
     $col = new Column($this, $name);
     if (!$col->exists()) {
         $col->set_cfg($cfg);
         $this->columns[$name] = $col;
         return $col;
     } else {
         throw new \System\Error\Database(sprintf("Column '%s' already exists in table '%s'", $name, $this->name));
     }
 }
开发者ID:just-paja,项目名称:fudjan,代码行数:11,代码来源:table.php

示例11: __construct

 /**
  * @api
  * @since 1.0.0
  *
  * @param DataTable\Column $column
  * @param integer|string|\DateTime $value
  * @param string $label
  * @throws InvalidArgumentException if the supplied value is not of the supplied column's data type
  * @throws InvalidArgumentException if the supplied label is not a string
  */
 public function __construct(Column $column, $value, $label = '')
 {
     $this->column = $column;
     if (!$this->column->isValueValidType($value)) {
         throw new \InvalidArgumentException("'{$value}' is not of type '{$column->getType()}'!");
     }
     if (!is_string($label)) {
         throw new \InvalidArgumentException("The cell label must be a string!");
     }
     $this->value = $value;
     $this->label = $label;
 }
开发者ID:zachgarwood,项目名称:datatable,代码行数:22,代码来源:Cell.php

示例12: create

 public function create($name, $configures = NULL)
 {
     $column = new Column();
     if (!empty($configures)) {
         if (is_array($configures)) {
             $column->set($configures);
         }
     }
     $column->set("name", $name);
     $this->add($column);
     return $column;
 }
开发者ID:elsewise,项目名称:gridded,代码行数:12,代码来源:ColumnBuilder.php

示例13: readHeader

 protected function readHeader()
 {
     $this->version = $this->readChar();
     $this->foxpro = $this->version == 48 || $this->version == 49 || $this->version == 245 || $this->version == 251;
     $this->modifyDate = $this->read3ByteDate();
     $this->recordCount = $this->readInt();
     $this->headerLength = $this->readShort();
     $this->recordByteLength = $this->readShort();
     $this->readBytes(2);
     //reserved
     $this->inTransaction = $this->readByte() != 0;
     $this->encrypted = $this->readByte() != 0;
     $this->readBytes(4);
     //Free record thread
     $this->readBytes(8);
     //Reserved for multi-user dBASE
     $this->mdxFlag = $this->readByte();
     $this->languageCode = $this->readByte();
     $this->readBytes(2);
     //reserved
     $fieldCount = floor(($this->headerLength - ($this->foxpro ? 296 : 33)) / 32);
     /* some checking */
     if ($this->headerLength > filesize($this->tableName)) {
         throw new Exception\TableException(sprintf('File %s is not DBF', $this->tableName));
     }
     if ($this->headerLength + $this->recordCount * $this->recordByteLength - 500 > filesize($this->tableName)) {
         throw new Exception\TableException(sprintf('File %s is not DBF', $this->tableName));
     }
     /* columns */
     $this->columns = array();
     $bytepos = 1;
     $j = 0;
     for ($i = 0; $i < $fieldCount; $i++) {
         $column = new Column(strtolower($this->readString(11)), $this->readByte(), $this->readInt(), $this->readChar(), $this->readChar(), $this->readBytes(2), $this->readChar(), $this->readBytes(2), $this->readByte() != 0, $this->readBytes(7), $this->readByte() != 0, $j, $bytepos);
         $bytepos += $column->getLength();
         if (!$this->avaliableColumns || $this->avaliableColumns && in_array($column->name, $this->avaliableColumns)) {
             $this->addColumn($column);
             $j++;
         }
     }
     if ($this->foxpro) {
         $this->backlist = $this->readBytes(263);
     }
     $this->setFilePos($this->headerLength);
     $this->recordPos = -1;
     $this->record = false;
     $this->deleteCount = 0;
 }
开发者ID:caiweiming,项目名称:php-xbase,代码行数:48,代码来源:Table.php

示例14: testFactories

 public function testFactories()
 {
     // char
     $this->assertEquals(new CharColumn('foo', 'char', 0), Column::char('foo', 0));
     $this->assertEquals(new CharColumn('foo', 'varchar', 0), Column::varchar('foo', 0));
     // datetime
     $this->assertEquals(new DateTimeColumn('foo'), Column::datetime('foo'));
     // decimal
     $this->assertEquals(new DecimalColumn('foo', 10, 2), Column::decimal('foo', 10, 2));
     // float
     $this->assertEquals(new FloatColumn('foo', 10, 2), Column::float('foo', 10, 2));
     // int
     $this->assertEquals(new IntColumn('foo', 'tinyint'), Column::tinyint('foo'));
     $this->assertEquals(new IntColumn('foo', 'smallint'), Column::smallint('foo'));
     $this->assertEquals(new IntColumn('foo', 'int'), Column::int('foo'));
     $this->assertEquals(new IntColumn('foo', 'mediumint'), Column::mediumint('foo'));
     $this->assertEquals(new IntColumn('foo', 'bigint'), Column::bigint('foo'));
     $this->assertEquals((new IntColumn('foo', 'tinyint'))->setUnsigned()->setAutoIncrement(), Column::tinyserial('foo'));
     $this->assertEquals((new IntColumn('foo', 'smallint'))->setUnsigned()->setAutoIncrement(), Column::smallserial('foo'));
     $this->assertEquals((new IntColumn('foo', 'int'))->setUnsigned()->setAutoIncrement(), Column::serial('foo'));
     $this->assertEquals((new IntColumn('foo', 'mediumint'))->setUnsigned()->setAutoIncrement(), Column::mediumserial('foo'));
     $this->assertEquals((new IntColumn('foo', 'bigint'))->setUnsigned()->setAutoIncrement(), Column::bigserial('foo'));
     // text
     $this->assertEquals(new TextColumn('foo', 'tinytext'), Column::tinytext('foo'));
     $this->assertEquals(new TextColumn('foo', 'text'), Column::text('foo'));
     $this->assertEquals(new TextColumn('foo', 'mediumtext'), Column::mediumtext('foo'));
     $this->assertEquals(new TextColumn('foo', 'longtext'), Column::longtext('foo'));
     // timestamp
     $this->assertEquals(new TimestampColumn('foo'), Column::timestamp('foo'));
 }
开发者ID:vegvari,项目名称:AliusDatabase,代码行数:30,代码来源:ColumnTest.php

示例15: columns

 public function columns($cb)
 {
     Column::reset();
     call_user_func($cb);
     $this->column = Column::get();
     return $this;
 }
开发者ID:hugofabricio,项目名称:laravel-crud,代码行数:7,代码来源:AdminItem.php


注:本文中的Column类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。