mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Updating all setter methods on DBField to return an instance of themselves
This commit is contained in:
parent
3633d6e27f
commit
38e86f04d8
@ -148,7 +148,7 @@ abstract class DBField extends ViewableData
|
|||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
*
|
*
|
||||||
* @return DBField
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setName($name)
|
public function setName($name)
|
||||||
{
|
{
|
||||||
@ -196,10 +196,12 @@ abstract class DBField extends ViewableData
|
|||||||
* @param bool $markChanged Indicate wether this field should be marked changed.
|
* @param bool $markChanged Indicate wether this field should be marked changed.
|
||||||
* Set to FALSE if you are initializing this field after construction, rather
|
* Set to FALSE if you are initializing this field after construction, rather
|
||||||
* than setting a new value.
|
* than setting a new value.
|
||||||
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setValue($value, $record = null, $markChanged = true)
|
public function setValue($value, $record = null, $markChanged = true)
|
||||||
{
|
{
|
||||||
$this->value = $value;
|
$this->value = $value;
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -446,7 +448,9 @@ abstract class DBField extends ViewableData
|
|||||||
{
|
{
|
||||||
$fieldName = $this->name;
|
$fieldName = $this->name;
|
||||||
if (empty($fieldName)) {
|
if (empty($fieldName)) {
|
||||||
throw new \BadMethodCallException("DBField::saveInto() Called on a nameless '" . get_class($this) . "' object");
|
throw new \BadMethodCallException(
|
||||||
|
"DBField::saveInto() Called on a nameless '" . get_class($this) . "' object"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$dataObject->$fieldName = $this->value;
|
$dataObject->$fieldName = $this->value;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user