/** * Save all investment dynamic properties values to database. * @param Investment $inv * @param bool $isNew */ protected static function SaveProperties(Investment $inv, $isNew) { $props = new Properties(); $lst = array(); if (!$isNew) { $query = "SELECT id, properties_id, value FROM #S#investments_properties WHERE investments_id=? AND investments_id_lng=?"; $result = DataBase::GetDbInstance()->ExecuteQueryWithParams($query, array((int) $inv->GetId(), (int) $inv->GetIdLng())); while ($row = DataBase::GetDbInstance()->FetchArray($result)) { $lst[$row['properties_id']][] = array("id" => $row['id'], "value" => $row['value']); } } foreach ($inv->data as $key => $value) { $prop = Properties::GetWithAddProperty($key); Properties::SavePropertyValueForInv($prop, $inv, $value, $isNew, $lst); } }