Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

会員マスタの検索条件のセッション保持方法を変更 #2113

Merged
merged 5 commits into from Mar 21, 2017

Conversation

chihiro-adachi
Copy link
Contributor

概要(Overview・Refs Issue)

#2112 の対応

方針(Policy)

entityをセッションに保持するのは推奨されていない
entityではなく、postされたデータをセッションに保持し、利用時に復元するように修正

参考
http://qiita.com/tarokamikaze/items/b6cb73be0294fe6b14c1#14ajax%E7%94%A8%E3%81%AE-api-%E4%BD%9C%E3%82%8A%E3%81%9F%E3%81%84

実装に関する補足(Appendix)

  • 受注検索、商品検索も同様に対応する必要がある

テスト(Test)

相談(Discussion)

@ryo-endo ryo-endo added this to the 3.0.14 milestone Feb 21, 2017
@chihiro-adachi
Copy link
Contributor Author

@ryo-endo
テストを追加しました。
受注と検索も同様の対応が必要ですが、一旦会員の修正は完了しています。

Copy link
Contributor

@trebla-on trebla-on left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

■動作確認結果
顧客レーコドを52登録して会員検索画面
を確認しました。
全て項目保存されます。
ページングも正しく動きます。
会員詳細画面へ移動して、会員編集して戻ったら前の検索ページに戻りました。
問題ありませんでした。
■ソースレビュー
Entityの内容は配列に変えてSessionに保存するようになってます。
ロッジクを確認しました、問題ありません

@t-nagahashi t-nagahashi added enhancement 機能追加 and removed Status: fix-me labels Feb 24, 2017
@t-nagahashi t-nagahashi changed the title [WIP] 会員マスタの検索条件のセッション保持方法を変更 会員マスタの検索条件のセッション保持方法を変更 Feb 24, 2017
@t-nagahashi t-nagahashi modified the milestones: 3.0.x, 3.0.14 Feb 28, 2017
@chihiro-adachi
Copy link
Contributor Author

@ryo-endo @t-nagahashi
AddressTypeなど、子要素を持つFormTypeのデータが正しく取れてなかったので追加で修正しました。

023ba39

@trebla-on
Copy link
Contributor

trebla-on commented Mar 6, 2017

@chihiro-adachi
別の対応のためにこのBranchを使いましたがPHPエラー出てます

( ! ) Warning: array_flip(): Can only flip STRING and INTEGER values! in /var/www/eccube/vendor/symfony/form/Extension/Core/Type/ChoiceType.php on line 114
Call Stack

再現手順
1.顧客マスタで検索をする
2.結果の中に「20件」に変更すると上のPHP Warningを表示する

 #	|Time	|Memory	|Function	|Location
1	0.0002	380648	{main}( )	.../index.php:0
2	0.1702	2817624	Silex\Application->run( )	.../index.php:51
3	0.1704	2829856	Silex\Application->handle( )	.../Application.php:563
4	0.1759	3172056	Symfony\Component\HttpKernel\HttpKernel->handle( )	.../Application.php:586
5	0.1759	3172472	Symfony\Component\HttpKernel\HttpKernel->handleRaw( )	.../HttpKernel.php:64
6	0.2203	4062376	call_user_func_array:{/var/www/eccube/vendor/symfony/http-kernel/HttpKernel.php:144} ( )	.../HttpKernel.php:144
7	0.2203	4062800	Eccube\Controller\Admin\Customer\CustomerController->index( )	.../HttpKernel.php:144
8	0.2539	5629776	Eccube\Util\FormUtil::submitAndGetData( )	.../CustomerController.php:108
9	0.2539	5629776	Symfony\Component\Form\Form->submit( )	.../FormUtil.php:62
10	0.2614	5671560	Symfony\Component\Form\Form->submit( )	.../Form.php:567
11	0.2614	5672408	Symfony\Component\EventDispatcher\ImmutableEventDispatcher->dispatch( )	.../Form.php:546
12	0.2614	5672408	Symfony\Component\EventDispatcher\EventDispatcher->dispatch( )	.../ImmutableEventDispatcher.php:43
13	0.2614	5672408	Symfony\Component\EventDispatcher\EventDispatcher->doDispatch( )	.../EventDispatcher.php:46
14	0.2614	5672408	call_user_func:{/var/www/eccube/vendor/symfony/event-dispatcher/EventDispatcher.php:161} ( )	.../EventDispatcher.php:161
15	0.2614	5672408	Symfony\Component\Form\Extension\Core\Type\ChoiceType->Symfony\Component\Form\Extension\Core\Type\{closure}( )	.../EventDispatcher.php:161
16	0.2614	5672408	array_flip ( )	.../ChoiceType.php:114

備考:PHP7.1 MySQL 5.5

だいたい問題わかります。
チェックボックスが空の時エラー出てます

会員種別と性別をチェックしたらエラーなくなります
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
上の問題対応しました
getViewData()の中に配列をチェックしてNULLのものをの外しました。
https://github.com/trebla-on/ec-cube/blob/653993797fafdd39597b4bdc6f32e24ca9736d30/src/Eccube/Util/FormUtil.php#L49-L56

@chihiro-adachi
Copy link
Contributor Author

@trebla-on
ありがとうございます。
提示いただいた修正だと、

$formData = array(
   'sex' => array(1, 2)
);

のときに取得できるviewDataが

array(
   'sex' => array(1 => 1, 2 => 2)
);

となりキー値がずれて正しく制御できていません。

choice typeで問題が発生していたので、以下のように修正しています。

a74de65

@t-nagahashi t-nagahashi modified the milestones: 3.0.15, 3.0.x Mar 15, 2017
Copy link
Contributor

@ryo-endo ryo-endo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

コードレビュー。動作確認OKです。

影響範囲は、管理画面の会員検索。
検索実行のときにセッションに保持されるデータ形式が変わるだけなので、互換性含めて問題ないと思います。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants