baseelementhasparent error

baseelementhasparent error

by Fernando Martín -
Number of replies: 0

Hello developers,


I've coded a new module for moodle, called Digui. I'm attempting to backup this activity, but during the process it generates the following error:


Debug info:
Error code: baseelementhasparent
$a contents: stdClass Object
(
[currparent] => subdigui
[newparent] => color
[element] => colors_assignments
)


The code which causes this error is in the backup_digui_activity_structure_step function, in the file backup_digui_stepslib.php, and is:


$subdigui->add_child($colors_assignments);
$color->add_child($colors_assignments);


As you can see, the $colors_assignments variable has two parents: $subdigui and $color, and this is the error. It seems that a table can't have two foreign keys. How can I implement this database schema in the  backup_digui_activity_structure_step function, using the add_child method?


I'm using the 3.1.1 version of Moodle, and I've downloaded from https://download.moodle.org/windows/, with mySQL and Apache preinstalled.


Thank you in advance.

Average of ratings: -