@@ -59,6 +59,7 @@ public function load($id, $id_lang, $entity, $entity_defs, $id_shop, $should_cac
59
59
}
60
60
61
61
if ($ object_datas = Db::getInstance ()->getRow ($ sql )) {
62
+ $ objectVars = get_object_vars ($ entity );
62
63
if (!$ id_lang && isset ($ entity_defs ['multilang ' ]) && $ entity_defs ['multilang ' ]) {
63
64
$ sql = 'SELECT *
64
65
FROM ` ' . bqSQL (_DB_PREFIX_ . $ entity_defs ['table ' ]) . '_lang`
@@ -68,7 +69,7 @@ public function load($id, $id_lang, $entity, $entity_defs, $id_shop, $should_cac
68
69
if ($ object_datas_lang = Db::getInstance ()->executeS ($ sql )) {
69
70
foreach ($ object_datas_lang as $ row ) {
70
71
foreach ($ row as $ key => $ value ) {
71
- if ($ key != $ entity_defs ['primary ' ] && array_key_exists ($ key , $ entity )) {
72
+ if ($ key != $ entity_defs ['primary ' ] && array_key_exists ($ key , $ objectVars )) {
72
73
if (!isset ($ object_datas [$ key ]) || !is_array ($ object_datas [$ key ])) {
73
74
$ object_datas [$ key ] = array ();
74
75
}
@@ -81,7 +82,9 @@ public function load($id, $id_lang, $entity, $entity_defs, $id_shop, $should_cac
81
82
}
82
83
$ entity ->id = (int )$ id ;
83
84
foreach ($ object_datas as $ key => $ value ) {
84
- if (array_key_exists ($ key , $ entity )) {
85
+ //if (array_key_exists($key, $entity)) {
86
+ if (array_key_exists ($ key , $ entity_defs ['fields ' ])
87
+ || array_key_exists ($ key , $ objectVars )) {
85
88
$ entity ->{$ key } = $ value ;
86
89
} else {
87
90
unset($ object_datas [$ key ]);
0 commit comments