1
我在我的數據庫有500個條目。在我的後端,我有行動。例如:Symfony 1.4改進學說save()方法
public function executeMyAction(sfWebRequest $request) {
// Get some data from table
$templates = Doctrine_Core::getTable('SeoTemplates')->findOneByEntity('training');
//Get data from other table(500 items)
$trainings = Doctrine::getTable('Training')->getTraining();
// Make some operations with data
foreach ($trainings as $training) {
$training->setSomeValue1('some_data');
$training->setSomeValue2('some_data');
$training->setSomeValue2('some_data');
}
// Problem part (try to save)
$trainings->save();
}
save()執行了很長時間。如何解決這個問題呢?可能嗎?
在我的問題的一部分我都知道的錯誤致命錯誤:
謝謝!第二種方法是快速的:-) – denys281