質問編集履歴
1
質問内容の変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,75 +1,59 @@
|
|
1
|
-
|
1
|
+
http://symfony.com/doc/current/reference/forms/types/entity.html#using-a-custom-query-for-the-entities
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
-
$builder
|
6
|
-
|
7
|
-
// 商品規格情報
|
8
|
-
|
9
|
-
->add('class', 'admin_product_class', array(
|
10
|
-
|
11
|
-
'mapped' => false,
|
12
|
-
|
13
|
-
))
|
14
|
-
|
15
|
-
// 基本情報
|
16
|
-
|
17
|
-
->add('name', 'text', array(
|
18
|
-
|
19
|
-
'label' => '商品名',
|
20
|
-
|
21
|
-
'constraints' => array(
|
22
|
-
|
23
|
-
new Assert\NotBlank(),
|
24
|
-
|
25
|
-
),
|
26
|
-
|
27
|
-
))
|
28
|
-
|
29
|
-
->add('product_image', 'file', array(
|
30
|
-
|
31
|
-
'label' => '商品画像',
|
32
|
-
|
33
|
-
'multiple' => true,
|
34
|
-
|
35
|
-
'required' => false,
|
36
|
-
|
37
|
-
'mapped' => false,
|
38
|
-
|
39
|
-
))
|
40
|
-
|
41
|
-
|
5
|
+
https://github.com/EC-CUBE/ec-cube/blob/3.0.10/src/Eccube/Form/Type/ShippingMultipleItemType.php#L75</blockquote></div>
|
42
|
-
|
43
|
-
'label' => '商品説明',
|
44
|
-
|
45
|
-
))
|
46
|
-
|
47
|
-
->add('description_list', 'textarea', array(
|
48
|
-
|
49
|
-
'label' => '商品説明(一覧)',
|
50
|
-
|
51
|
-
'required' => false,
|
52
|
-
|
53
|
-
))
|
54
|
-
|
55
|
-
->add('Category', 'category', array(
|
56
|
-
|
57
|
-
'label' => '商品カテゴリ',
|
58
|
-
|
59
|
-
'multiple' => true,
|
60
|
-
|
61
|
-
'mapped' => false,
|
62
|
-
|
63
|
-
))
|
64
|
-
|
65
|
-
・・・
|
66
6
|
|
67
7
|
|
68
8
|
|
69
|
-
ここの商品カテゴリのところをカスタマイズすればよいと思うのですが
|
70
|
-
|
71
|
-
query_builderを
|
9
|
+
これらを参考にし、query_builderを使用して実現しようとしているのですが
|
72
10
|
|
73
11
|
|
74
12
|
|
13
|
+
'query_builder' => function (EntityRepository $er) use ($Customer) {
|
14
|
+
|
15
|
+
return $er->createQueryBuilder('ca')
|
16
|
+
|
17
|
+
->where('ca.Customer = :Customer')
|
18
|
+
|
19
|
+
->orderBy("ca.id", "ASC")
|
20
|
+
|
21
|
+
->setParameter('Customer', $Customer);
|
22
|
+
|
23
|
+
},
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
このようになっている場合、functionの後ろには何を記載しているのでしょうか?
|
28
|
+
|
29
|
+
createQueryBuilderを呼び出しているため
|
30
|
+
|
31
|
+
vendor\doctrine\orm\lib\Doctrine\ORMの
|
32
|
+
|
33
|
+
クラスを記載しているものと思いますが
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
createQueryBuilder自体が
|
38
|
+
|
39
|
+
EntityManager.phpとEntityRepository.phpにあるため
|
40
|
+
|
41
|
+
どちらを呼び出すのだろうと悩んでしまいました。
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
また、createQueryBuilderの後ろも''で囲われているもので
|
46
|
+
|
47
|
+
ここはテーブルの略称なのかな?と思うのでなんでもいいのかもしれませんが…
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
->where('ca.Customer = :Customer')
|
52
|
+
|
53
|
+
where句もどのように記載すればいいのか…
|
54
|
+
|
55
|
+
|
56
|
+
|
75
|
-
|
57
|
+
これらのヒントなどご教示いただけますと幸いです。
|
58
|
+
|
59
|
+
よろしくお願いいたします。
|