本文整理汇总了PHP中Cake\Database\Schema\Table::columnType方法的典型用法代码示例。如果您正苦于以下问题:PHP Table::columnType方法的具体用法?PHP Table::columnType怎么用?PHP Table::columnType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\Database\Schema\Table
的用法示例。
在下文中一共展示了Table::columnType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _initializeSchema
/**
* Tell CakePHP to modify the data structure of the entity data types
* @param Schema $schema this table's schema
* @return Schema the adjusted schema definition
*/
protected function _initializeSchema(Schema $schema)
{
$schema->columnType('sent_to', 'json');
$schema->columnType('sent_from', 'json');
$schema->columnType('email_data', 'json');
return $schema;
}
示例2: _initializeSchema
/**
* @param \Cake\Database\Schema\Table $table Table schema
* @return \Cake\Database\Schema\Table
*/
protected function _initializeSchema(Schema $table)
{
$table->columnType('payload', 'serialize');
$table->columnType('options', 'serialize');
$table->columnType('history', 'json');
return parent::_initializeSchema($table);
}
示例3: testColumnType
/**
* Test columnType method
*
* @return void
*/
public function testColumnType()
{
$table = new Table('articles');
$table->addColumn('title', ['type' => 'string', 'length' => 25, 'null' => false]);
$this->assertEquals('string', $table->columnType('title'));
$this->assertNull($table->columnType('not there'));
}
示例4: _initializeSchema
protected function _initializeSchema(Schema $table)
{
$table->columnType('email', 'crypted');
$table->columnType('username', 'crypted');
$table->columnType('last_ip', 'crypted');
$table->columnType('token', 'crypted');
return $table;
}
示例5: _initializeSchema
/**
* Initialize schema method
*
* @param \Cake\Database\Schema\Table $schema The schema of the Table.
*
* @return \Cake\Database\Schema\Table
*/
protected function _initializeSchema(Schema $schema)
{
$schema->columnType('secret', 'encryptedsecurity');
$schema->columnType('username', 'encryptedsecurity');
$schema->columnType('session', 'encryptedsecurity');
$schema->columnType('recovery_code', 'encryptedsecurity');
return $schema;
}
示例6: _initializeSchema
/**
* @param \Cake\Database\Schema\Table $table
*
* @return \Cake\Database\Schema\Table
*/
protected function _initializeSchema(Schema $table)
{
$table->columnType('image', 'image');
return $table;
}
示例7: _getRecords
/**
* Converts the internal records into data used to generate a query
* for given table schema.
*
* @param \Schema\Table $schema Table schema.
* @param array $records Internal records.
* @return array Fields, values and types.
*/
protected function _getRecords(Table $schema, $records)
{
$fields = $values = $types = [];
$columns = $schema->columns();
foreach ($records as $record) {
$fields = array_merge($fields, array_intersect(array_keys($record), $columns));
}
$fields = array_values(array_unique($fields));
foreach ($fields as $field) {
$types[$field] = $schema->columnType($field);
}
$default = array_fill_keys($fields, null);
foreach ($records as $record) {
$values[] = array_merge($default, $record);
}
return [$fields, $values, $types];
}
示例8: _initializeSchema
/**
* Initialize Schema
*
* @param Schema $schema
* @return Schema
*/
protected function _initializeSchema(Schema $schema)
{
$schema->columnType('data', 'json');
$schema->columnType('stats', 'json');
return $schema;
}
示例9: _initializeSchema
/**
* _initializeSchema
*/
protected function _initializeSchema(\Cake\Database\Schema\Table $table)
{
$table->columnType('image', 'proffer.file');
return $table;
}
示例10: _initializeSchema
protected function _initializeSchema(Schema $table)
{
$table->columnType('ip', 'ip');
return parent::_initializeSchema($table);
}
示例11: _initializeSchema
protected function _initializeSchema(Schema $schema)
{
$schema->columnType('context', 'loggingJson');
return $schema;
}
示例12: column
/**
* Returns an array of column data for a single column
*
* @param \Cake\Database\Schema\Table $tableSchema Name of the table to retrieve columns for
* @param string $column A column to retrieve data for
* @return array
*/
public function column($tableSchema, $column)
{
return ['columnType' => $tableSchema->columnType($column), 'options' => $this->attributes($tableSchema->name(), $column)];
}
示例13: _initializeSchema
/**
* Tell CakePHP to modify the data structure of the entity data types
* @param Schema $schema this table's schema
* @return Schema the adjusted schema definition
*/
protected function _initializeSchema(Schema $schema)
{
$schema->columnType('from_addr', 'json');
$schema->columnType('sender_addr', 'json');
$schema->columnType('to_addr', 'json');
$schema->columnType('cc_addr', 'json');
$schema->columnType('bcc_addr', 'json');
$schema->columnType('replyTo', 'json');
$schema->columnType('readReceipt', 'json');
$schema->columnType('returnPath', 'json');
$schema->columnType('headers', 'json');
$schema->columnType('viewVars', 'json');
$schema->columnType('processor', 'json');
$schema->columnType('attachments', 'json');
$schema->columnType('helpers', 'json');
return $schema;
}
示例14: testBaseColumnTypeInherited
/**
* Tests getting the base type as it is retuned by the Type class
*
* @return void
*/
public function testBaseColumnTypeInherited()
{
Type::map('foo', __NAMESPACE__ . '\\FooType');
$table = new Table('articles');
$table->addColumn('thing', ['type' => 'foo', 'null' => false]);
$this->assertEquals('foo', $table->columnType('thing'));
$this->assertEquals('integer', $table->baseColumnType('thing'));
}
示例15: _initializeSchema
/**
* @param \Cake\Database\Schema\Table $schema
* @return \Cake\Database\Schema\Table
*/
protected function _initializeSchema(Schema $schema)
{
$schema->columnType('foreign_data', 'json');
return $schema;
}