1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* This file is part of EC-CUBE |
4
|
|
|
* |
5
|
|
|
* Copyright(c) 2000-2015 LOCKON CO.,LTD. All Rights Reserved. |
6
|
|
|
* |
7
|
|
|
* http://www.lockon.co.jp/ |
8
|
|
|
* |
9
|
|
|
* This program is free software; you can redistribute it and/or |
10
|
|
|
* modify it under the terms of the GNU General Public License |
11
|
|
|
* as published by the Free Software Foundation; either version 2 |
12
|
|
|
* of the License, or (at your option) any later version. |
13
|
|
|
* |
14
|
|
|
* This program is distributed in the hope that it will be useful, |
15
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
16
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17
|
|
|
* GNU General Public License for more details. |
18
|
|
|
* |
19
|
|
|
* You should have received a copy of the GNU General Public License |
20
|
|
|
* along with this program; if not, write to the Free Software |
21
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
22
|
|
|
*/ |
23
|
|
|
|
24
|
|
|
|
25
|
|
|
namespace Eccube\Repository; |
26
|
|
|
|
27
|
|
|
use Doctrine\ORM\EntityRepository; |
28
|
|
|
use Eccube\Common\Constant; |
29
|
|
|
use Eccube\Entity\Customer; |
30
|
|
|
use Eccube\Entity\Master\CustomerStatus; |
31
|
|
|
use Eccube\Util\Str; |
32
|
|
|
use Symfony\Component\Security\Core\Exception\UnsupportedUserException; |
33
|
|
|
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException; |
34
|
|
|
use Symfony\Component\Security\Core\User\UserInterface; |
35
|
|
|
use Symfony\Component\Security\Core\User\UserProviderInterface; |
36
|
|
|
use Symfony\Component\Security\Core\Util\SecureRandom; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* CustomerRepository |
40
|
|
|
* |
41
|
|
|
* This class was generated by the Doctrine ORM. Add your own custom |
42
|
|
|
* repository methods below. |
43
|
|
|
*/ |
44
|
|
|
class CustomerRepository extends EntityRepository implements UserProviderInterface |
45
|
|
|
{ |
46
|
|
|
protected $app; |
47
|
|
|
|
48
|
|
|
public function setApplication($app) |
|
|
|
|
49
|
|
|
{ |
50
|
|
|
$this->app = $app; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
public function newCustomer() |
|
|
|
|
54
|
|
|
{ |
55
|
|
|
$Customer = new \Eccube\Entity\Customer(); |
56
|
|
|
$Status = $this->getEntityManager() |
57
|
|
|
->getRepository('Eccube\Entity\Master\CustomerStatus') |
58
|
|
|
->find(1); |
59
|
|
|
|
60
|
|
|
$Customer |
61
|
|
|
->setStatus($Status) |
62
|
|
|
->setDelFlg(0); |
63
|
|
|
|
64
|
|
|
return $Customer; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Loads the user for the given username. |
69
|
|
|
* |
70
|
|
|
* This method must throw UsernameNotFoundException if the user is not |
71
|
|
|
* found. |
72
|
|
|
* |
73
|
|
|
* @param string $username The username |
74
|
|
|
* |
75
|
|
|
* @return UserInterface |
76
|
|
|
* |
77
|
|
|
* @see UsernameNotFoundException |
78
|
|
|
* |
79
|
|
|
* @throws UsernameNotFoundException if the user is not found |
80
|
|
|
*/ |
81
|
|
|
public function loadUserByUsername($username) |
82
|
|
|
{ |
83
|
|
|
// 本会員ステータスの会員のみ有効. |
84
|
|
|
$CustomerStatus = $this |
85
|
|
|
->getEntityManager() |
86
|
|
|
->getRepository('Eccube\Entity\Master\CustomerStatus') |
87
|
|
|
->find(CustomerStatus::ACTIVE); |
88
|
|
|
|
89
|
|
|
$query = $this->createQueryBuilder('c') |
90
|
|
|
->where('c.email = :email') |
91
|
|
|
->andWhere('c.del_flg = :delFlg') |
92
|
|
|
->andWhere('c.Status =:CustomerStatus') |
93
|
|
|
->setParameters(array( |
94
|
|
|
'email' => $username, |
95
|
|
|
'delFlg' => Constant::DISABLED, |
96
|
|
|
'CustomerStatus' => $CustomerStatus, |
97
|
|
|
)) |
98
|
|
|
->getQuery(); |
99
|
|
|
$Customer = $query->getOneOrNullResult(); |
100
|
|
|
if (!$Customer) { |
101
|
|
|
throw new UsernameNotFoundException(sprintf('Username "%s" does not exist.', $username)); |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
return $Customer; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* Refreshes the user for the account interface. |
109
|
|
|
* |
110
|
|
|
* It is up to the implementation to decide if the user data should be |
111
|
|
|
* totally reloaded (e.g. from the database), or if the UserInterface |
112
|
|
|
* object can just be merged into some internal array of users / identity |
113
|
|
|
* map. |
114
|
|
|
* |
115
|
|
|
* @param UserInterface $user |
116
|
|
|
* |
117
|
|
|
* @return UserInterface |
118
|
|
|
* |
119
|
|
|
* @throws UnsupportedUserException if the account is not supported |
120
|
|
|
*/ |
121
|
|
View Code Duplication |
public function refreshUser(UserInterface $user) |
|
|
|
|
122
|
|
|
{ |
123
|
|
|
if (!$user instanceof Customer) { |
|
|
|
|
124
|
|
|
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', get_class($user))); |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
return $this->loadUserByUsername($user->getUsername()); |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* Whether this provider supports the given user class. |
132
|
|
|
* |
133
|
|
|
* @param string $class |
134
|
|
|
* |
135
|
|
|
* @return bool |
136
|
|
|
*/ |
137
|
|
|
public function supportsClass($class) |
138
|
|
|
{ |
139
|
|
|
return $class === 'Eccube\Entity\Customer'; |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
public function getQueryBuilderBySearchData($searchData) |
|
|
|
|
143
|
|
|
{ |
144
|
|
|
$qb = $this->createQueryBuilder('c') |
145
|
|
|
->select('c') |
146
|
|
|
->andWhere('c.del_flg = 0'); |
147
|
|
|
|
148
|
|
|
if (isset($searchData['multi']) && Str::isNotBlank($searchData['multi'])) { |
149
|
|
|
//スペース除去 |
150
|
|
|
$clean_key_multi = preg_replace('/\s+|[ ]+/u', '',$searchData['multi']); |
|
|
|
|
151
|
|
|
if (preg_match('/^\d+$/', $clean_key_multi)) { |
152
|
|
|
$qb |
153
|
|
|
->andWhere('c.id = :customer_id') |
154
|
|
|
->setParameter('customer_id', $clean_key_multi); |
155
|
|
|
} else { |
156
|
|
|
$qb |
157
|
|
|
->andWhere('CONCAT(c.name01, c.name02) LIKE :name OR CONCAT(c.kana01, c.kana02) LIKE :kana OR c.email LIKE :email') |
158
|
|
|
->setParameter('name', '%' . $clean_key_multi . '%') |
|
|
|
|
159
|
|
|
->setParameter('kana', '%' . $clean_key_multi . '%') |
|
|
|
|
160
|
|
|
->setParameter('email', '%' . $clean_key_multi . '%'); |
|
|
|
|
161
|
|
|
} |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
// Pref |
165
|
|
|
if (!empty($searchData['pref']) && $searchData['pref']) { |
166
|
|
|
$qb |
167
|
|
|
->andWhere('c.Pref = :pref') |
168
|
|
|
->setParameter('pref', $searchData['pref']->getId()); |
169
|
|
|
} |
170
|
|
|
|
171
|
|
|
// sex |
172
|
|
|
if (!empty($searchData['sex']) && count($searchData['sex']) > 0) { |
173
|
|
|
$sexs = array(); |
174
|
|
|
foreach ($searchData['sex'] as $sex) { |
175
|
|
|
$sexs[] = $sex->getId(); |
176
|
|
|
} |
177
|
|
|
|
178
|
|
|
$qb |
179
|
|
|
->andWhere($qb->expr()->in('c.Sex', ':sexs')) |
180
|
|
|
->setParameter('sexs', $sexs); |
181
|
|
|
} |
182
|
|
|
|
183
|
|
|
// birth_month |
184
|
|
|
// TODO: http://docs.symfony.gr.jp/symfony2/cookbook/doctrine/custom_dql_functions.html |
185
|
|
|
if (!empty($searchData['birth_month']) && $searchData['birth_month']) { |
|
|
|
|
186
|
|
|
// $qb |
|
|
|
|
187
|
|
|
// ->andWhere('extract(month from c.birth) = :birth_month') |
188
|
|
|
// ->setParameter('birth_month', $searchData['birth_month']); |
189
|
|
|
} |
190
|
|
|
|
191
|
|
|
// birth |
192
|
|
View Code Duplication |
if (!empty($searchData['birth_start']) && $searchData['birth_start']) { |
|
|
|
|
193
|
|
|
$date = $searchData['birth_start'] |
194
|
|
|
->format('Y-m-d H:i:s'); |
195
|
|
|
$qb |
196
|
|
|
->andWhere('c.birth >= :birth_start') |
197
|
|
|
->setParameter('birth_start', $date); |
198
|
|
|
} |
199
|
|
View Code Duplication |
if (!empty($searchData['birth_end']) && $searchData['birth_end']) { |
|
|
|
|
200
|
|
|
$date = clone $searchData['birth_end']; |
201
|
|
|
$date = $date |
202
|
|
|
->modify('+1 days') |
203
|
|
|
->format('Y-m-d H:i:s'); |
204
|
|
|
$qb |
205
|
|
|
->andWhere('c.birth < :birth_end') |
206
|
|
|
->setParameter('birth_end', $date); |
207
|
|
|
} |
208
|
|
|
|
209
|
|
|
// tel |
210
|
|
View Code Duplication |
if (isset($searchData['tel']) && Str::isNotBlank($searchData['tel'])) { |
|
|
|
|
211
|
|
|
$qb |
212
|
|
|
->andWhere('CONCAT(c.tel01, c.tel02, c.tel03) LIKE :tel') |
213
|
|
|
->setParameter('tel', '%' . $searchData['tel'] . '%'); |
|
|
|
|
214
|
|
|
} |
215
|
|
|
|
216
|
|
|
// buy_total |
217
|
|
View Code Duplication |
if (isset($searchData['buy_total_start']) && Str::isNotBlank($searchData['buy_total_start'])) { |
|
|
|
|
218
|
|
|
$qb |
219
|
|
|
->andWhere('c.buy_total >= :buy_total_start') |
220
|
|
|
->setParameter('buy_total_start', $searchData['buy_total_start']); |
221
|
|
|
} |
222
|
|
View Code Duplication |
if (isset($searchData['buy_total_end']) && Str::isNotBlank($searchData['buy_total_end'])) { |
|
|
|
|
223
|
|
|
$qb |
224
|
|
|
->andWhere('c.buy_total <= :buy_total_end') |
225
|
|
|
->setParameter('buy_total_end', $searchData['buy_total_end']); |
226
|
|
|
} |
227
|
|
|
|
228
|
|
|
// buy_times |
229
|
|
|
if (!empty($searchData['buy_times_start']) && $searchData['buy_times_start']) { |
230
|
|
|
$qb |
231
|
|
|
->andWhere('c.buy_times >= :buy_times_start') |
232
|
|
|
->setParameter('buy_times_start', $searchData['buy_times_start']); |
233
|
|
|
} |
234
|
|
|
if (!empty($searchData['buy_times_end']) && $searchData['buy_times_end']) { |
235
|
|
|
$qb |
236
|
|
|
->andWhere('c.buy_times <= :buy_times_end') |
237
|
|
|
->setParameter('buy_times_end', $searchData['buy_times_end']); |
238
|
|
|
} |
239
|
|
|
|
240
|
|
|
// create_date |
241
|
|
View Code Duplication |
if (!empty($searchData['create_date_start']) && $searchData['create_date_start']) { |
|
|
|
|
242
|
|
|
$date = $searchData['create_date_start'] |
243
|
|
|
->format('Y-m-d H:i:s'); |
244
|
|
|
$qb |
245
|
|
|
->andWhere('c.create_date >= :create_date_start') |
246
|
|
|
->setParameter('create_date_start', $date); |
247
|
|
|
} |
248
|
|
View Code Duplication |
if (!empty($searchData['create_date_end']) && $searchData['create_date_end']) { |
|
|
|
|
249
|
|
|
$date = clone $searchData['create_date_end']; |
250
|
|
|
$date = $date |
251
|
|
|
->modify('+1 days') |
252
|
|
|
->format('Y-m-d H:i:s'); |
253
|
|
|
$qb |
254
|
|
|
->andWhere('c.create_date < :create_date_end') |
255
|
|
|
->setParameter('create_date_end', $date); |
256
|
|
|
} |
257
|
|
|
|
258
|
|
|
// update_date |
259
|
|
View Code Duplication |
if (!empty($searchData['update_date_start']) && $searchData['update_date_start']) { |
|
|
|
|
260
|
|
|
$date = $searchData['update_date_start'] |
261
|
|
|
->format('Y-m-d H:i:s'); |
262
|
|
|
$qb |
263
|
|
|
->andWhere('c.update_date >= :update_date_start') |
264
|
|
|
->setParameter('update_date_start', $date); |
265
|
|
|
} |
266
|
|
View Code Duplication |
if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) { |
|
|
|
|
267
|
|
|
$date = clone $searchData['update_date_end']; |
268
|
|
|
$date = $date |
269
|
|
|
->modify('+1 days') |
270
|
|
|
->format('Y-m-d H:i:s'); |
271
|
|
|
$qb |
272
|
|
|
->andWhere('c.update_date < :update_date_end') |
273
|
|
|
->setParameter('update_date_end', $date); |
274
|
|
|
} |
275
|
|
|
|
276
|
|
|
// last_buy |
277
|
|
View Code Duplication |
if (!empty($searchData['last_buy_start']) && $searchData['last_buy_start']) { |
|
|
|
|
278
|
|
|
$date = $searchData['last_buy_start'] |
279
|
|
|
->format('Y-m-d H:i:s'); |
280
|
|
|
$qb |
281
|
|
|
->andWhere('c.last_buy_date >= :last_buy_start') |
282
|
|
|
->setParameter('last_buy_start', $date); |
283
|
|
|
} |
284
|
|
View Code Duplication |
if (!empty($searchData['last_buy_end']) && $searchData['last_buy_end']) { |
|
|
|
|
285
|
|
|
$date = clone $searchData['last_buy_end']; |
286
|
|
|
$date = $date |
287
|
|
|
->modify('+1 days') |
288
|
|
|
->format('Y-m-d H:i:s'); |
289
|
|
|
$qb |
290
|
|
|
->andWhere('c.last_buy_date < :last_buy_end') |
291
|
|
|
->setParameter('last_buy_end', $date); |
292
|
|
|
} |
293
|
|
|
|
294
|
|
|
// status |
295
|
|
|
if (!empty($searchData['customer_status']) && count($searchData['customer_status']) > 0) { |
296
|
|
|
$qb |
297
|
|
|
->andWhere($qb->expr()->in('c.Status', ':statuses')) |
298
|
|
|
->setParameter('statuses', $searchData['customer_status']); |
299
|
|
|
} |
300
|
|
|
|
301
|
|
|
// buy_product_name、buy_product_code |
302
|
|
View Code Duplication |
if (isset($searchData['buy_product_code']) && Str::isNotBlank($searchData['buy_product_code'])) { |
|
|
|
|
303
|
|
|
$qb |
304
|
|
|
->leftJoin('c.Orders', 'o') |
305
|
|
|
->leftJoin('o.OrderDetails', 'od') |
306
|
|
|
->andWhere('od.product_name LIKE :buy_product_name OR od.product_code LIKE :buy_product_name') |
307
|
|
|
->setParameter('buy_product_name', '%' . $searchData['buy_product_code'] . '%'); |
|
|
|
|
308
|
|
|
} |
309
|
|
|
|
310
|
|
|
// Order By |
311
|
|
|
$qb->addOrderBy('c.update_date', 'DESC'); |
312
|
|
|
|
313
|
|
|
return $qb; |
314
|
|
|
} |
315
|
|
|
|
316
|
|
|
/** |
|
|
|
|
317
|
|
|
* ユニークなシークレットキーを返す |
318
|
|
|
* @param $app |
|
|
|
|
319
|
|
|
* @return string |
320
|
|
|
*/ |
321
|
|
View Code Duplication |
public function getUniqueSecretKey($app) |
|
|
|
|
322
|
|
|
{ |
323
|
|
|
$unique = Str::random(32); |
324
|
|
|
$Customer = $app['eccube.repository.customer']->findBy(array( |
325
|
|
|
'secret_key' => $unique, |
326
|
|
|
)); |
327
|
|
|
if (count($Customer) == 0) { |
328
|
|
|
return $unique; |
329
|
|
|
} else { |
330
|
|
|
return $this->getUniqueSecretKey($app); |
331
|
|
|
} |
332
|
|
|
} |
333
|
|
|
|
334
|
|
|
/** |
|
|
|
|
335
|
|
|
* ユニークなパスワードリセットキーを返す |
336
|
|
|
* @param $app |
|
|
|
|
337
|
|
|
* @return string |
338
|
|
|
*/ |
339
|
|
View Code Duplication |
public function getUniqueResetKey($app) |
|
|
|
|
340
|
|
|
{ |
341
|
|
|
$unique = Str::random(32); |
342
|
|
|
$Customer = $app['eccube.repository.customer']->findBy(array( |
343
|
|
|
'reset_key' => $unique, |
344
|
|
|
)); |
345
|
|
|
if (count($Customer) == 0) { |
346
|
|
|
return $unique; |
347
|
|
|
} else { |
348
|
|
|
return $this->getUniqueResetKey($app); |
349
|
|
|
} |
350
|
|
|
} |
351
|
|
|
|
352
|
|
|
/** |
|
|
|
|
353
|
|
|
* saltを生成する |
354
|
|
|
* |
355
|
|
|
* @param $byte |
|
|
|
|
356
|
|
|
* @return string |
357
|
|
|
*/ |
358
|
|
|
public function createSalt($byte) |
359
|
|
|
{ |
360
|
|
|
$generator = new SecureRandom(); |
361
|
|
|
|
362
|
|
|
return bin2hex($generator->nextBytes($byte)); |
363
|
|
|
} |
364
|
|
|
|
365
|
|
|
/** |
|
|
|
|
366
|
|
|
* 入力されたパスワードをSaltと暗号化する |
367
|
|
|
* |
368
|
|
|
* @param $app |
|
|
|
|
369
|
|
|
* @param Customer $Customer |
370
|
|
|
* @return mixed |
371
|
|
|
*/ |
372
|
|
|
public function encryptPassword($app, \Eccube\Entity\Customer $Customer) |
373
|
|
|
{ |
374
|
|
|
$encoder = $app['security.encoder_factory']->getEncoder($Customer); |
375
|
|
|
|
376
|
|
|
return $encoder->encodePassword($Customer->getPassword(), $Customer->getSalt()); |
377
|
|
|
} |
378
|
|
|
|
379
|
|
|
public function getNonActiveCustomerBySecretKey($secret_key) |
|
|
|
|
380
|
|
|
{ |
381
|
|
|
$qb = $this->createQueryBuilder('c') |
382
|
|
|
->where('c.del_flg = 0 AND c.secret_key = :secret_key') |
383
|
|
|
->leftJoin('c.Status', 's') |
384
|
|
|
->andWhere('s.id = :status') |
385
|
|
|
->setParameter('secret_key', $secret_key) |
386
|
|
|
->setParameter('status', CustomerStatus::NONACTIVE); |
387
|
|
|
$query = $qb->getQuery(); |
388
|
|
|
|
389
|
|
|
return $query->getSingleResult(); |
390
|
|
|
} |
391
|
|
|
|
392
|
|
|
public function getActiveCustomerByEmail($email) |
|
|
|
|
393
|
|
|
{ |
394
|
|
|
$query = $this->createQueryBuilder('c') |
395
|
|
|
->where('c.email = :email AND c.Status = :status') |
396
|
|
|
->setParameter('email', $email) |
397
|
|
|
->setParameter('status', CustomerStatus::ACTIVE) |
398
|
|
|
->getQuery(); |
399
|
|
|
|
400
|
|
|
$Customer = $query->getOneOrNullResult(); |
401
|
|
|
|
402
|
|
|
return $Customer; |
403
|
|
|
} |
404
|
|
|
|
405
|
|
|
public function getActiveCustomerByResetKey($reset_key) |
|
|
|
|
406
|
|
|
{ |
407
|
|
|
$query = $this->createQueryBuilder('c') |
408
|
|
|
->where('c.reset_key = :reset_key AND c.Status = :status AND c.reset_expire >= :reset_expire') |
409
|
|
|
->setParameter('reset_key', $reset_key) |
410
|
|
|
->setParameter('status', CustomerStatus::ACTIVE) |
411
|
|
|
->setParameter('reset_expire', new \DateTime()) |
412
|
|
|
->getQuery(); |
413
|
|
|
|
414
|
|
|
$Customer = $query->getSingleResult(); |
415
|
|
|
|
416
|
|
|
return $Customer; |
417
|
|
|
} |
418
|
|
|
|
419
|
|
|
public function getResetPassword() |
|
|
|
|
420
|
|
|
{ |
421
|
|
|
return Str::random(8); |
422
|
|
|
} |
423
|
|
|
|
424
|
|
|
/** |
|
|
|
|
425
|
|
|
* 会員の初回購入時間、購入時間、購入回数、購入金額を更新する |
426
|
|
|
* |
427
|
|
|
* @param $app |
|
|
|
|
428
|
|
|
* @param Customer $Customer |
|
|
|
|
429
|
|
|
* @param $orderStatusId |
|
|
|
|
430
|
|
|
*/ |
431
|
|
|
public function updateBuyData($app, Customer $Customer, $orderStatusId) |
432
|
|
|
{ |
433
|
|
|
// 会員の場合、初回購入時間・購入時間・購入回数・購入金額を更新 |
434
|
|
|
|
435
|
|
|
$arr = array($app['config']['order_new'], |
436
|
|
|
$app['config']['order_pay_wait'], |
437
|
|
|
$app['config']['order_back_order'], |
438
|
|
|
$app['config']['order_deliv'], |
439
|
|
|
$app['config']['order_pre_end'], |
440
|
|
|
); |
441
|
|
|
|
442
|
|
|
$result = $app['eccube.repository.order']->getCustomerCount($Customer, $arr); |
443
|
|
|
|
444
|
|
|
if (!empty($result)) { |
445
|
|
|
$data = $result[0]; |
446
|
|
|
|
447
|
|
|
$now = new \DateTime(); |
448
|
|
|
|
449
|
|
|
$firstBuyDate = $Customer->getFirstBuyDate(); |
450
|
|
|
if (empty($firstBuyDate)) { |
451
|
|
|
$Customer->setFirstBuyDate($now); |
452
|
|
|
} |
453
|
|
|
|
454
|
|
|
if ($orderStatusId == $app['config']['order_cancel'] || |
|
|
|
|
455
|
|
|
$orderStatusId == $app['config']['order_pending'] || |
456
|
|
|
$orderStatusId == $app['config']['order_processing']) { |
457
|
|
|
// キャンセル、決済処理中、購入処理中は購入時間は更新しない |
458
|
|
|
} else { |
459
|
|
|
$Customer->setLastBuyDate($now); |
460
|
|
|
} |
461
|
|
|
|
462
|
|
|
$Customer->setBuyTimes($data['buy_times']); |
463
|
|
|
$Customer->setBuyTotal($data['buy_total']); |
464
|
|
|
|
|
|
|
|
465
|
|
|
} else { |
466
|
|
|
// 受注データが存在しなければ初期化 |
467
|
|
|
$Customer->setFirstBuyDate(null); |
468
|
|
|
$Customer->setLastBuyDate(null); |
469
|
|
|
$Customer->setBuyTimes(0); |
470
|
|
|
$Customer->setBuyTotal(0); |
471
|
|
|
} |
472
|
|
|
|
473
|
|
|
$app['orm.em']->persist($Customer); |
474
|
|
|
$app['orm.em']->flush(); |
475
|
|
|
} |
476
|
|
|
} |
477
|
|
|
|