I have two objects and the way our finder function works (I have to call it twice... 1 to get the config key, value i.e. non multilanguage stuff. And the second call to get the multilanguage stuff) makes them look like this:
[config] => Array
(
[cfg] => Config_Model Object
(
[id] => 2
[key] => system.default.main_color
[value] => #FF7C11
[deleted] => 0
)
[help] => Config_Model Object
(
[id] =>
[key] =>
[value] =>
[id_config] => 2
[name] => Hauptfarbe
[help] => Die Hauptfarbe Ihres CIs. Der Adminbereich erscheint in dieser Farbe.
[id_lang] => 1
)
)
I want to compine these two objects into one. The code, that gets the stuff looks like this:
public static function get($key)
{
$config['cfg'] = self::find(array('key' => $key), TRUE);
$config['help'] = self::findInTable(array(
'id_lang' => Language_Model::getDefaultLanguage(),
'id_config' => $config['cfg']->getId()
), self::dbTranslationTable, TRUE);
return $config;
// return (object) array_merge((array) $config['cfg'], (array) $config['help']);
}
You can tell by the commented return command, that I tried using array_merge(). The problem with that is, that the empty attributes from [help] override the attributes from [cfg], so they are empty again:
[config] => stdClass Object
(
[id] =>
[key] =>
[value] =>
[deleted] => 0
[id_config] => 2
[name] => Hauptfarbe
[help] => Die Hauptfarbe Ihres CIs. Der Adminbereich erscheint in dieser Farbe.
[id_lang] => 1
)
Whereas it should rather look like this:
[config] => stdClass Object
(
[id] => 2
[key] => system.defalult.main_color
[value] => #FF7C11
[deleted] => 0
[id_config] => 2
[name] => Hauptfarbe
[help] => Die Hauptfarbe Ihres CIs. Der Adminbereich erscheint in dieser Farbe.
[id_lang] => 1
)
If you need more information, please let me know.