Harden model populate methods
Co-authored-by: LeOSW42 <673670+LeOSW42@users.noreply.github.com>
This commit is contained in:
@@ -48,9 +48,19 @@ class Locale
|
||||
** Populate the object using raw data from SQL
|
||||
*****/
|
||||
public function populate($row) {
|
||||
$this->name = $row['name'];
|
||||
$this->display_name = $row['display_name'];
|
||||
$this->flag_name = $row['flag_name'];
|
||||
if (!is_array($row)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (array_key_exists('name', $row)) {
|
||||
$this->name = $row['name'];
|
||||
}
|
||||
if (array_key_exists('display_name', $row)) {
|
||||
$this->display_name = $row['display_name'];
|
||||
}
|
||||
if (array_key_exists('flag_name', $row)) {
|
||||
$this->flag_name = $row['flag_name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,4 +105,4 @@ class Locales
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user