0
當我的選擇條件加入到它們中時,如何使用propel在symfony中進行批量更新?這是我想要做的一個例子。使用Propel在Symfony中批量更新
$conn = Propel::getConnection(BudgetLinePeer::DATABASE_NAME);
// Create a Criteria object that will select the correct rows from the database
$selectCriteria = new Criteria();
$selectCriteria->add(BudgetLinePeer::IDCOL1, $idcol1, Criteria::EQUAL);
$selectCriteria->addJoin(ProjectBudgetLinePeer::IDBUDGET_LINE, BudgetLinePeer::IDBUDGET_LINE);
$selectCriteria->add(ProjectBudgetLinePeer::IDCLIENT, $idclient, Criteria::EQUAL);
$selectCriteria->add(ProjectBudgetLinePeer::IDPROJECT, $project->getIdproject(), Criteria::EQUAL);
// Create a Criteria object includes the value you want to set
$updateCriteria = new Criteria();
$updateCriteria->add(BudgetLinePeer::STATUS, $status);
// Execute the query
BasePeer::doUpdate($selectCriteria, $updateCriteria, $conn);
我想在表BudgetLine中進行更新(更新新狀態)。
編輯:這是我收到錯誤的片段:
在 /應用程序/ MAMP/htdocs中/ proj_ict_new /主幹/立方米/插件/ sfPropelORMPlugin /爲的foreach()提供無效參數lib/vendor/propel/runtime/lib/util/BasePeer.php on line 369
這與join語句有關。我試圖用useXYZQuery()->filterCon()->endUse()
。但最終再次出現同樣的錯誤。
而且,問題是什麼? – j0k
請參閱編輯。 –