mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Compare commits
2 Commits
b8bdf23e1e
...
a4614a65ce
Author | SHA1 | Date | |
---|---|---|---|
|
a4614a65ce | ||
|
baeaef4b61 |
@ -13,8 +13,7 @@ class DBBoolean extends DBField
|
|||||||
{
|
{
|
||||||
public function __construct($name = null, $defaultVal = 0)
|
public function __construct($name = null, $defaultVal = 0)
|
||||||
{
|
{
|
||||||
$defaultValue = $defaultVal ? 1 : 0;
|
$this->defaultVal = ($defaultVal) ? 1 : 0;
|
||||||
$this->setDefaultValue($defaultValue);
|
|
||||||
|
|
||||||
parent::__construct($name);
|
parent::__construct($name);
|
||||||
}
|
}
|
||||||
@ -26,7 +25,7 @@ class DBBoolean extends DBField
|
|||||||
'precision' => 1,
|
'precision' => 1,
|
||||||
'sign' => 'unsigned',
|
'sign' => 'unsigned',
|
||||||
'null' => 'not null',
|
'null' => 'not null',
|
||||||
'default' => $this->getDefaultValue(),
|
'default' => $this->defaultVal,
|
||||||
'arrayValue' => $this->arrayValue
|
'arrayValue' => $this->arrayValue
|
||||||
];
|
];
|
||||||
$values = ['type' => 'boolean', 'parts' => $parts];
|
$values = ['type' => 'boolean', 'parts' => $parts];
|
||||||
|
@ -122,7 +122,7 @@ abstract class DBField extends ViewableData implements DBIndexable
|
|||||||
* @var $default mixed Default-value in the database.
|
* @var $default mixed Default-value in the database.
|
||||||
* Might be overridden on DataObject-level, but still useful for setting defaults on
|
* Might be overridden on DataObject-level, but still useful for setting defaults on
|
||||||
* already existing records after a db-build.
|
* already existing records after a db-build.
|
||||||
* @deprecated 5.4.0 Use getDefaultValue() and setDefaultValue() instead
|
* @deprecated 5.4.0 Call setDefaultValue() in constructor instead
|
||||||
*/
|
*/
|
||||||
protected $defaultVal;
|
protected $defaultVal;
|
||||||
|
|
||||||
|
@ -13,8 +13,7 @@ class DBFloat extends DBField
|
|||||||
|
|
||||||
public function __construct($name = null, $defaultVal = 0)
|
public function __construct($name = null, $defaultVal = 0)
|
||||||
{
|
{
|
||||||
$defaultValue = is_float($defaultVal) ? $defaultVal : (float) 0;
|
$this->defaultVal = is_float($defaultVal) ? $defaultVal : (float) 0;
|
||||||
$this->setDefaultValue($defaultValue);
|
|
||||||
|
|
||||||
parent::__construct($name);
|
parent::__construct($name);
|
||||||
}
|
}
|
||||||
@ -24,7 +23,7 @@ class DBFloat extends DBField
|
|||||||
$parts = [
|
$parts = [
|
||||||
'datatype' => 'float',
|
'datatype' => 'float',
|
||||||
'null' => 'not null',
|
'null' => 'not null',
|
||||||
'default' => $this->getDefaultValue(),
|
'default' => $this->defaultVal,
|
||||||
'arrayValue' => $this->arrayValue
|
'arrayValue' => $this->arrayValue
|
||||||
];
|
];
|
||||||
$values = ['type' => 'float', 'parts' => $parts];
|
$values = ['type' => 'float', 'parts' => $parts];
|
||||||
|
@ -15,8 +15,7 @@ class DBInt extends DBField
|
|||||||
|
|
||||||
public function __construct($name = null, $defaultVal = 0)
|
public function __construct($name = null, $defaultVal = 0)
|
||||||
{
|
{
|
||||||
$defaultValue = is_int($defaultVal) ? $defaultVal : 0;
|
$this->defaultVal = is_int($defaultVal) ? $defaultVal : 0;
|
||||||
$this->setDefaultValue($defaultValue);
|
|
||||||
|
|
||||||
parent::__construct($name);
|
parent::__construct($name);
|
||||||
}
|
}
|
||||||
@ -44,7 +43,7 @@ class DBInt extends DBField
|
|||||||
'datatype' => 'int',
|
'datatype' => 'int',
|
||||||
'precision' => 11,
|
'precision' => 11,
|
||||||
'null' => 'not null',
|
'null' => 'not null',
|
||||||
'default' => $this->getDefaultValue(),
|
'default' => $this->defaultVal,
|
||||||
'arrayValue' => $this->arrayValue
|
'arrayValue' => $this->arrayValue
|
||||||
];
|
];
|
||||||
$values = ['type' => 'int', 'parts' => $parts];
|
$values = ['type' => 'int', 'parts' => $parts];
|
||||||
|
Loading…
Reference in New Issue
Block a user