public function searchCustomerById(Application $app, Request $request)
{
if ($request->isXmlHttpRequest()) {
$app['monolog']->addDebug('search customer by id start.');
/** @var $Customer \Eccube\Entity\Customer */
$Customer = $app['eccube.repository.customer']->find($request->get('id'));
$event = new EventArgs(array('Customer' => $Customer), $request);
$app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_ORDER_EDIT_SEARCH_CUSTOMER_BY_ID_INITIALIZE, $event);
if (is_null($Customer)) {
$app['monolog']->addDebug('search customer by id not found.');
return $app->json(array(), 404);
}
$app['monolog']->addDebug('search customer by id found.');
$data = array('id' => $Customer->getId(), 'name01' => $Customer->getName01(), 'name02' => $Customer->getName02(), 'kana01' => $Customer->getKana01(), 'kana02' => $Customer->getKana02(), 'zip01' => $Customer->getZip01(), 'zip02' => $Customer->getZip02(), 'pref' => is_null($Customer->getPref()) ? null : $Customer->getPref()->getId(), 'addr01' => $Customer->getAddr01(), 'addr02' => $Customer->getAddr02(), 'email' => $Customer->getEmail(), 'tel01' => $Customer->getTel01(), 'tel02' => $Customer->getTel02(), 'tel03' => $Customer->getTel03(), 'fax01' => $Customer->getFax01(), 'fax02' => $Customer->getFax02(), 'fax03' => $Customer->getFax03(), 'company_name' => $Customer->getCompanyName());
$event = new EventArgs(array('data' => $data, 'Customer' => $Customer), $request);
$app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_ORDER_EDIT_SEARCH_CUSTOMER_BY_ID_COMPLETE, $event);
$data = $event->getArgument('data');
return $app->json($data);
}
}