Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Add deprecation #11427

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/ORM/FieldType/DBBoolean.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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];
Expand Down
1 change: 1 addition & 0 deletions src/ORM/FieldType/DBField.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +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 Use getDefaultValue() and setDefaultValue() instead
*/
protected $defaultVal;

Expand Down
5 changes: 3 additions & 2 deletions src/ORM/FieldType/DBFloat.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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];
Expand Down
5 changes: 3 additions & 2 deletions src/ORM/FieldType/DBInt.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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];
Expand Down