本文整理汇总了PHP中SilverStripe\ORM\DB::require_field方法的典型用法代码示例。如果您正苦于以下问题:PHP DB::require_field方法的具体用法?PHP DB::require_field怎么用?PHP DB::require_field使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SilverStripe\ORM\DB
的用法示例。
在下文中一共展示了DB::require_field方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: requireField
/**
* (non-PHPdoc)
* @see DBField::requireField()
*/
public function requireField()
{
$charset = Config::inst()->get('SilverStripe\\ORM\\Connect\\MySQLDatabase', 'charset');
$collation = Config::inst()->get('SilverStripe\\ORM\\Connect\\MySQLDatabase', 'collation');
$parts = ['datatype' => 'mediumtext', 'character set' => $charset, 'collate' => $collation, 'default' => $this->defaultVal, 'arrayValue' => $this->arrayValue];
$values = ['type' => 'text', 'parts' => $parts];
DB::require_field($this->tableName, $this->name, $values);
}
示例2: requireField
/**
* (non-PHPdoc)
* @see DBField::requireField()
*/
public function requireField()
{
$charset = Config::inst()->get('SilverStripe\\ORM\\Connect\\MySQLDatabase', 'charset');
$collation = Config::inst()->get('SilverStripe\\ORM\\Connect\\MySQLDatabase', 'collation');
$parts = array('datatype' => 'varchar', 'precision' => $this->size, 'character set' => $charset, 'collate' => $collation, 'arrayValue' => $this->arrayValue);
$values = array('type' => 'varchar', 'parts' => $parts);
DB::require_field($this->tableName, $this->name, $values);
}
示例3: requireField
public function requireField()
{
// @todo: Remove mysql-centric logic from this
$charset = Config::inst()->get('SilverStripe\\ORM\\Connect\\MySQLDatabase', 'charset');
$collation = Config::inst()->get('SilverStripe\\ORM\\Connect\\MySQLDatabase', 'collation');
$values = array('type' => 'set', 'parts' => array('enums' => $this->enum, 'character set' => $charset, 'collate' => $collation, 'default' => $this->default, 'table' => $this->tableName, 'arrayValue' => $this->arrayValue));
DB::require_field($this->tableName, $this->name, $values);
}
示例4: requireField
public function requireField()
{
// HACK: MSSQL does not support double so we're using float instead
// @todo This should go into MSSQLDatabase ideally somehow
if (DB::get_conn() instanceof MySQLDatabase) {
DB::require_field($this->tableName, $this->name, "double");
} else {
DB::require_field($this->tableName, $this->name, "float");
}
}
示例5: requireField
public function requireField()
{
$parts = array('datatype' => 'float', 'null' => 'not null', 'default' => $this->defaultVal, 'arrayValue' => $this->arrayValue);
$values = array('type' => 'float', 'parts' => $parts);
DB::require_field($this->tableName, $this->name, $values);
}
示例6: requireField
/**
* @return void
*/
public function requireField()
{
$parts = array('datatype' => 'enum', 'enums' => $this->getEnumObsolete(), 'character set' => 'utf8', 'collate' => 'utf8_general_ci', 'default' => $this->getDefault(), 'table' => $this->getTable(), 'arrayValue' => $this->arrayValue);
$values = array('type' => 'enum', 'parts' => $parts);
DB::require_field($this->getTable(), $this->getName(), $values);
}
示例7: requireField
public function requireField()
{
$parts = array('datatype' => 'time', 'arrayValue' => $this->arrayValue);
$values = array('type' => 'time', 'parts' => $parts);
DB::require_field($this->tableName, $this->name, $values);
}
示例8: requireField
public function requireField()
{
$parts = array('datatype' => 'tinyint', 'precision' => 1, 'sign' => 'unsigned', 'null' => 'not null', 'default' => $this->defaultVal, 'arrayValue' => $this->arrayValue);
$values = array('type' => 'boolean', 'parts' => $parts);
DB::require_field($this->tableName, $this->name, $values);
}
示例9: requireField
public function requireField()
{
$parts = ['datatype' => 'int', 'precision' => 11, 'null' => 'not null', 'default' => $this->defaultVal, 'arrayValue' => $this->arrayValue];
$values = ['type' => 'int', 'parts' => $parts];
DB::require_field($this->tableName, $this->name, $values);
}
示例10: requireField
public function requireField()
{
$parts = array('datatype' => 'decimal', 'precision' => "{$this->wholeSize},{$this->decimalSize}", 'default' => $this->defaultValue, 'arrayValue' => $this->arrayValue);
$values = array('type' => 'decimal', 'parts' => $parts);
DB::require_field($this->tableName, $this->name, $values);
}
示例11: requireField
public function requireField()
{
$spec = DB::get_schema()->IdColumn(false, $this->getAutoIncrement());
DB::require_field($this->getTable(), $this->getName(), $spec);
}
示例12: requireField
public function requireField()
{
foreach ($this->compositeDatabaseFields() as $field => $spec) {
$key = $this->getName() . $field;
DB::require_field($this->tableName, $key, $spec);
}
}