質問 > その他 > Customizeフォルダーでのカスタマイズ方法 |
その他
フラット表示 | 前のトピック | 次のトピック |
投稿者 | スレッド |
---|---|
jacker |
投稿日時: 2019/12/11 11:31
対応状況: −−−
|
新米 登録日: 2019/7/10 居住地: 投稿: 10 |
Re: Customizeフォルダーでのカスタマイズ方法 umebiusさん
ご返信ありがとうございます。 初歩的な質問かと思いますが useと\Customize\Service\CsvExportServiceを直接指定する場合 違いはあるのでしょうか? いろいろやってみたのですが、うまくいきません。 $this->csvExportService->initCsvType(6)が存在しないとなってしまって ●useの方法 use Customize\Service\CsvExportService; private $csvExportService; public function __construct( CsvExportService $csvExportService ) { $this->csvExportService = $csvExportService; } ●回答いただいた方法 private $csvExportService; public function __construct( \Customize\Service\CsvExportService $csvExportService ) { $this->csvExportService = $csvExportService; } ●現在のコード ■app\Customize\Service\CsvExportService.php内容 namespace Customize\Service; use Customize\Form\Type\Admin\SearchContactType; use Customize\Repository\ContactRepository; use Symfony\Component\HttpFoundation\Request; use Eccube\Service as Service; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormFactoryInterface; class CsvExportService extends Service\CsvExportService { /** * @var CsvExportService */ protected $csvExportService; /** * @var ContactRepository */ protected $contactRepository; /** * CsvExportService constructor. * * @param ContactRepository $contactRepository */ public function __construct( ContactRepository $contactRepository ) { $this->contactRepository = $contactRepository; } ■app\Customize\Controller\Admin\Contact\ContactController.php内容 namespace Customize\Controller\Admin\Contact; use Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException; use Doctrine\ORM\QueryBuilder; use Eccube\Common\Constant; use Eccube\Controller\AbstractController; use Eccube\Entity\Master\CsvType; use Eccube\Event\EccubeEvents; use Eccube\Event\EventArgs; use Customize\Form\Type\Admin\SearchContactType; use Customize\Repository\ContactRepository; use Eccube\Repository\Master\PageMaxRepository; use Eccube\Repository\Master\PrefRepository; use Eccube\Repository\Master\SexRepository; #use Eccube\Service\CsvExportService; use Customize\Service\CsvExportService; use Eccube\Service\MailService; use Eccube\Util\FormUtil; use Knp\Component\Pager\Paginator; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\StreamedResponse; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Translation\TranslatorInterface; class ContactController extends AbstractController { /** * @var CsvExportService */ protected $csvExportService; /** * @var MailService */ protected $mailService; /** * @var PrefRepository */ protected $prefRepository; /** * @var SexRepository */ protected $sexRepository; /** * @var PageMaxRepository */ protected $pageMaxRepository; /** * @var ContactRepository */ protected $contactRepository; public function __construct( PageMaxRepository $pageMaxRepository, ContactRepository $contactRepository, SexRepository $sexRepository, PrefRepository $prefRepository, MailService $mailService, CsvExportService $csvExportService ) { $this->pageMaxRepository = $pageMaxRepository; $this->contactRepository = $contactRepository; $this->sexRepository = $sexRepository; $this->prefRepository = $prefRepository; $this->mailService = $mailService; $this->csvExportService = $csvExportService; } その他コード /** * お問合せCSVの出力. * * @Route("/%eccube_admin_route%/contact/export", name="admin_contact_export") * * @param Request $request * * @return StreamedResponse */ public function export(Request $request) { // タイムアウトを無効にする. set_time_limit(0); // sql loggerを無効にする. $em = $this->entityManager; $em->getConfiguration()->setSQLLogger(null); $response = new StreamedResponse(); $response->setCallback(function () use ($request) { // CSV種別を元に初期化. $this->csvExportService->initCsvType(6); // ヘッダ行の出力. $this->csvExportService->exportHeader(); // お問合せデータ検索用のクエリビルダを取得. $qb = $this->csvExportService ->getContactQueryBuilder($request); その他コード |
フラット表示 | 前のトピック | 次のトピック |
題名 | 投稿者 | 日時 |
---|---|---|
Customizeフォルダーでのカスタマイズ方法 | jacker | 2019/12/10 13:35 |
Re: Customizeフォルダーでのカスタマイズ方法 | umebius | 2019/12/10 17:04 |
» Re: Customizeフォルダーでのカスタマイズ方法 | jacker | 2019/12/11 11:31 |
Re: Customizeフォルダーでのカスタマイズ方法 | umebius | 2019/12/11 18:32 |
Re: Customizeフォルダーでのカスタマイズ方法 | jacker | 2019/12/12 9:25 |
Re: Customizeフォルダーでのカスタマイズ方法 | jacker | 2019/12/12 10:16 |
Re: Customizeフォルダーでのカスタマイズ方法 | umebius | 2019/12/12 10:27 |
Re: Customizeフォルダーでのカスタマイズ方法 | jacker | 2019/12/12 14:16 |