Magento에서 트랜잭션을 사용하고 있습니다. 모든 후속 쿼리에 첫 번째 삽입 쿼리의 primeryKey를 사용해야합니다.Magento는 트랜잭션 중간에 마지막으로 삽입 된 ID입니다.
$model1->setfield1()
->setField2();
$transaction->addObject($model1);
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
$lastInsertId = $connection->fetchOne('SELECT last_insert_id()'); // return 0
$model2->setfield3($lastInsertId)
$model3->setfield4($lastInsertId)
$transaction->addObject($model2);
$transaction->addObject($model3);
$transaction-Save();
$lastInsertId2 = $connection->fetchOne('SELECT last_insert_id()'); // returns correct result
마지막 얻을 트랜잭션이 Tyy
Magento에서 중첩 트랜잭션을 어떻게 사용할 수 있습니까? – sushantsahay