mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Fix small bug only reproduced in tests about changing field names and
xmldb_field object becoming modified. Novice OOP bug :-( Merged from MODLE_18_STABLE
This commit is contained in:
parent
bdb794843a
commit
c7a311b550
1 changed files with 5 additions and 2 deletions
|
@ -203,11 +203,14 @@ class XMLDBmysql extends XMLDBGenerator {
|
|||
|
||||
$results = array(); //Array where all the sentences will be stored
|
||||
|
||||
/// Need a clone of xmldb_field to perform the change leaving original unmodified
|
||||
$xmldb_field_clone = clone($xmldb_field);
|
||||
|
||||
/// Change the name of the field to perform the change
|
||||
$xmldb_field->setName($xmldb_field->getName() . ' ' . $newname);
|
||||
$xmldb_field_clone->setName($xmldb_field_clone->getName() . ' ' . $newname);
|
||||
|
||||
$results[] = 'ALTER TABLE ' . $this->getTableName($xmldb_table) . ' CHANGE ' .
|
||||
$this->getFieldSQL($xmldb_field);
|
||||
$this->getFieldSQL($xmldb_field_clone);
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue