Merge branch 'MDL-72779' of https://github.com/paulholden/moodle
This commit is contained in:
@@ -110,6 +110,8 @@ abstract class persistent {
|
||||
*
|
||||
* @param string $property The property name.
|
||||
* @return $this
|
||||
*
|
||||
* @throws coding_exception
|
||||
*/
|
||||
final public function set($property, $value) {
|
||||
if (!static::has_property($property)) {
|
||||
@@ -123,6 +125,21 @@ abstract class persistent {
|
||||
return $this->raw_set($property, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data setter for multiple properties
|
||||
*
|
||||
* Internally calls {@see set} on each property
|
||||
*
|
||||
* @param array $values Array of property => value elements
|
||||
* @return $this
|
||||
*/
|
||||
final public function set_many(array $values): self {
|
||||
foreach ($values as $property => $value) {
|
||||
$this->set($property, $value);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Data getter.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user