mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
API CHANGE: 'Year' datatype now uses abstracted array structure
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@71942 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
345693a6e0
commit
57dcdaa8be
@ -468,7 +468,7 @@ class MySQLDatabase extends Database {
|
|||||||
//For reference, this is what typically gets passed to this function:
|
//For reference, this is what typically gets passed to this function:
|
||||||
//$parts=Array('datatype'=>'decimal', 'precision'=>"$this->wholeSize,$this->decimalSize");
|
//$parts=Array('datatype'=>'decimal', 'precision'=>"$this->wholeSize,$this->decimalSize");
|
||||||
//DB::requireField($this->tableName, $this->name, "decimal($this->wholeSize,$this->decimalSize)");
|
//DB::requireField($this->tableName, $this->name, "decimal($this->wholeSize,$this->decimalSize)");
|
||||||
|
|
||||||
// Avoid empty strings being put in the db
|
// Avoid empty strings being put in the db
|
||||||
if($values['precision'] == '') {
|
if($values['precision'] == '') {
|
||||||
$precision = 1;
|
$precision = 1;
|
||||||
@ -580,6 +580,12 @@ class MySQLDatabase extends Database {
|
|||||||
return 'varchar(' . $values['precision'] . ') character set utf8 collate utf8_general_ci';
|
return 'varchar(' . $values['precision'] . ') character set utf8 collate utf8_general_ci';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return the MySQL-proprietary 'Year' datatype
|
||||||
|
*/
|
||||||
|
public function year($values){
|
||||||
|
return 'year(4)';
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* This returns the column which is the primary key for each table
|
* This returns the column which is the primary key for each table
|
||||||
* In Postgres, it is a SERIAL8, which is the equivalent of an auto_increment
|
* In Postgres, it is a SERIAL8, which is the equivalent of an auto_increment
|
||||||
|
@ -13,7 +13,9 @@
|
|||||||
class Year extends DBField {
|
class Year extends DBField {
|
||||||
|
|
||||||
function requireField() {
|
function requireField() {
|
||||||
DB::requireField($this->tableName, $this->name, "year(4)");
|
$parts=Array('datatype'=>'year', 'precision'=>4);
|
||||||
|
$values=Array('type'=>'year', 'parts'=>$parts);
|
||||||
|
DB::requireField($this->tableName, $this->name, $values);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scaffoldFormField($title = null, $params = null) {
|
public function scaffoldFormField($title = null, $params = null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user