本件、おそらく解決しました。
src/Eccube/Controller/EntryController.php
activate() 内、flush() の直後にトランザクションをcommitするようにしたところ、現象が起こらなくなりました。
(下記のソース内で★の処理を追加)
おそらくどこかでトランザクションが開始されたままcommitもrollbackもされず、DBに保存されなかったのだと思われます。
ただ、トランザクションを開始にしっぱなしにしているような怪しいソースはどこにも見当たらず、ログにもエラー等は出力されていなかったです。
また、再現条件も不明なままのため、確実に解決したかどうかはわかりません。
/**
* 会員のアクティベート(本会員化)を行う.
*
* @param Application $app
* @param Request $request
* @param $secret_key
* @return \Symfony\Component\HttpFoundation\Response
*/
public function activate(Application $app, Request $request, $secret_key)
{
$errors = $app['validator']->validateValue($secret_key, array(
new Assert\NotBlank(),
new Assert\Regex(array(
'pattern' => '/^[a-zA-Z0-9]+$/',
))
)
);
if ($request->getMethod() === 'GET' && count($errors) === 0) {
log_info('本会員登録開始');
try {
$Customer = $app['eccube.repository.customer']
->getNonActiveCustomerBySecretKey($secret_key);
} catch (\Exception $e) {
throw new HttpException\NotFoundHttpException('※ 既に会員登録が完了しているか、無効なURLです。');
}
$CustomerStatus = $app['eccube.repository.customer_status']->find(CustomerStatus::ACTIVE);
$Customer->setStatus($CustomerStatus);
$app['orm.em']->persist($Customer);
$app['orm.em']->flush();
$app['orm.em']->getConnection()->commit(); // ★ 追加
log_info('本会員登録完了');
$event = new EventArgs(
array(
'Customer' => $Customer,
),
$request
);
$app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_ENTRY_ACTIVATE_COMPLETE, $event);
// メール送信
$app['eccube.service.mail']->sendCustomerCompleteMail($Customer);
// 本会員登録してログイン状態にする
$token = new UsernamePasswordToken($Customer, null, 'customer', array('ROLE_USER'));
$this->getSecurity($app)->setToken($token);
$request->getSession()->migrate(true, $app['config']['cookie_lifetime']);
log_info('ログイン済に変更', array($app->user()->getId()));
return $app->render('Entry/activate.twig');
} else {
throw new HttpException\AccessDeniedHttpException('不正なアクセスです。');
}
}
----------------
EC-CUBE 《プラチナ》ランクパートナー
トエビス株式会社 田中 宏典
EC-CUBEの機能やデザインのカスタマイズ承ります。