Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: silverstripe/silverstripe-framework
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: baeaef4b61138ede6316ddfb1e967dc82125f87d
Choose a base ref
..
head repository: silverstripe/silverstripe-framework
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 8ec068f3fdfd8e062b5d54058bf629dbde034e0a
Choose a head ref
Showing with 10 additions and 7 deletions.
  1. +3 −2 src/ORM/FieldType/DBBoolean.php
  2. +1 −1 src/ORM/FieldType/DBField.php
  3. +3 −2 src/ORM/FieldType/DBFloat.php
  4. +3 −2 src/ORM/FieldType/DBInt.php
5 changes: 3 additions & 2 deletions src/ORM/FieldType/DBBoolean.php
Original file line number Diff line number Diff line change
@@ -13,7 +13,8 @@ class DBBoolean extends DBField
{
public function __construct($name = null, $defaultVal = 0)
{
$this->defaultVal = ($defaultVal) ? 1 : 0;
$defaultValue = $defaultVal ? 1 : 0;
$this->setDefaultValue($defaultValue);

parent::__construct($name);
}
@@ -25,7 +26,7 @@ public function requireField()
'precision' => 1,
'sign' => 'unsigned',
'null' => 'not null',
'default' => $this->defaultVal,
'default' => $this->getDefaultValue(),
'arrayValue' => $this->arrayValue
];
$values = ['type' => 'boolean', 'parts' => $parts];
2 changes: 1 addition & 1 deletion src/ORM/FieldType/DBField.php
Original file line number Diff line number Diff line change
@@ -122,7 +122,7 @@ abstract class DBField extends ViewableData implements DBIndexable
* @var $default mixed Default-value in the database.
* Might be overridden on DataObject-level, but still useful for setting defaults on
* already existing records after a db-build.
* @deprecated 5.4.0 Call setDefaultValue() in constructor instead
* @deprecated 5.4.0 Use getDefaultValue() and setDefaultValue() instead
*/
protected $defaultVal;

5 changes: 3 additions & 2 deletions src/ORM/FieldType/DBFloat.php
Original file line number Diff line number Diff line change
@@ -13,7 +13,8 @@ class DBFloat extends DBField

public function __construct($name = null, $defaultVal = 0)
{
$this->defaultVal = is_float($defaultVal) ? $defaultVal : (float) 0;
$defaultValue = is_float($defaultVal) ? $defaultVal : (float) 0;
$this->setDefaultValue($defaultValue);

parent::__construct($name);
}
@@ -23,7 +24,7 @@ public function requireField()
$parts = [
'datatype' => 'float',
'null' => 'not null',
'default' => $this->defaultVal,
'default' => $this->getDefaultValue(),
'arrayValue' => $this->arrayValue
];
$values = ['type' => 'float', 'parts' => $parts];
5 changes: 3 additions & 2 deletions src/ORM/FieldType/DBInt.php
Original file line number Diff line number Diff line change
@@ -15,7 +15,8 @@ class DBInt extends DBField

public function __construct($name = null, $defaultVal = 0)
{
$this->defaultVal = is_int($defaultVal) ? $defaultVal : 0;
$defaultValue = is_int($defaultVal) ? $defaultVal : 0;
$this->setDefaultValue($defaultValue);

parent::__construct($name);
}
@@ -43,7 +44,7 @@ public function requireField()
'datatype' => 'int',
'precision' => 11,
'null' => 'not null',
'default' => $this->defaultVal,
'default' => $this->getDefaultValue(),
'arrayValue' => $this->arrayValue
];
$values = ['type' => 'int', 'parts' => $parts];