我尝试立即用phalcon orm更新所有结果集。像这样:
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();
}
但它不起作用。应该怎么样?
答案 0 :(得分:0)
答案:
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));
}