mirror of
https://github.com/moodle/moodle.git
synced 2025-04-19 15:32:32 +02:00
Merge branch 'MDL-70139-master' of git://github.com/sarjona/moodle into master
This commit is contained in:
commit
1c3871e25a
14
badges/classes/external/assertion_exporter.php
vendored
14
badges/classes/external/assertion_exporter.php
vendored
@ -39,6 +39,20 @@ use stdClass;
|
||||
*/
|
||||
class assertion_exporter extends exporter {
|
||||
|
||||
/**
|
||||
* Constructor - saves the persistent object, and the related objects.
|
||||
*
|
||||
* @param mixed $data - Either an stdClass or an array of values.
|
||||
* @param array $related - An optional list of pre-loaded objects related to this object.
|
||||
*/
|
||||
public function __construct($data, $related = array()) {
|
||||
// Having mixed $data is causing some issues. As this class is treating $data as an object everywhere, it can be converted
|
||||
// to object at this point, to avoid errors and get the expected behaviour always.
|
||||
// $data is an array when this class is a request exporter in backpack_api_mapping, but it is an object when this is
|
||||
// used as a response exporter.
|
||||
parent::__construct((object) $data, $related);
|
||||
}
|
||||
|
||||
/**
|
||||
* Map from a request response data to the internal structure.
|
||||
*
|
||||
|
@ -45,6 +45,12 @@ class badgeclass_exporter extends exporter {
|
||||
* @param array $related - An optional list of pre-loaded objects related to this object.
|
||||
*/
|
||||
public function __construct($data, $related = array()) {
|
||||
// Having mixed $data is causing some issues. As this class is treating $data as an object everywhere, it can be converted
|
||||
// to object at this point, to avoid errors and get the expected behaviour always.
|
||||
// $data is an array when this class is a request exporter in backpack_api_mapping, but it is an object when this is
|
||||
// used as a response exporter.
|
||||
$data = (object) $data;
|
||||
|
||||
$pick = $this->pick_related();
|
||||
foreach ($pick as $one) {
|
||||
$isarray = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user