我尝试一次使用PhalconORM更新所有结果集。 像这样:
foreach ($packages as $package) {
$rates = $package->getRates();
$package->rates = $rates;
$package->update();
$packageHistory = PackageHistories::find('rates = 0 AND package_id = '.$package->id);
$packageHistory->rates = $rates;
$packageHistory->update();
}
但它不起作用。 它应该是什么样子??
答案:
foreach ($packages as $package) {
$rates = $package->getRates();
$package->rates = $rates;
$package->update();
$packageHistory = PackageHistories::find('rates = 0 AND package_id = '.$package->id)->update(array('rates' => $rates));
}