Completed
Push — 4.0 ( 268f2c...88f012 )
by Hideki
05:48 queued 10s
created

src/Eccube/Entity/CustomerAddress.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/*
4
 * This file is part of EC-CUBE
5
 *
6
 * Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
7
 *
8
 * http://www.ec-cube.co.jp/
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Eccube\Entity;
15
16
use Doctrine\ORM\Mapping as ORM;
17
18 1
if (!class_exists('\Eccube\Entity\CustomerAddress')) {
19
    /**
20
     * CustomerAddress
21
     *
22
     * @ORM\Table(name="dtb_customer_address")
23
     * @ORM\InheritanceType("SINGLE_TABLE")
24
     * @ORM\DiscriminatorColumn(name="discriminator_type", type="string", length=255)
25
     * @ORM\HasLifecycleCallbacks()
26
     * @ORM\Entity(repositoryClass="Eccube\Repository\CustomerAddressRepository")
27
     */
28
    class CustomerAddress extends AbstractEntity
29
    {
30
        /**
31
         * getShippingMultipleDefaultName
32
         *
33
         * @return string
34
         */
35 26
        public function getShippingMultipleDefaultName()
36
        {
37 26
            return $this->getName01().' '.$this->getPref()->getName().' '.$this->getAddr01().' '.$this->getAddr02();
38
        }
39
40
        /**
41
         * Set from customer.
42
         *
43
         * @param \Eccube\Entity\Customer $Customer
44
         *
45
         * @return \Eccube\Entity\CustomerAddress
46
         */
47 26 View Code Duplication
        public function setFromCustomer(Customer $Customer)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
48
        {
49
            $this
50 26
            ->setCustomer($Customer)
51 26
            ->setName01($Customer->getName01())
52 26
            ->setName02($Customer->getName02())
53 26
            ->setKana01($Customer->getKana01())
54 26
            ->setKana02($Customer->getKana02())
55 26
            ->setCompanyName($Customer->getCompanyName())
56 26
            ->setPhoneNumber($Customer->getPhoneNumber())
57 26
            ->setPostalCode($Customer->getPostalCode())
58 26
            ->setPref($Customer->getPref())
59 26
            ->setAddr01($Customer->getAddr01())
60 26
            ->setAddr02($Customer->getAddr02());
61
62 26
            return $this;
63
        }
64
65
        /**
66
         * Set from Shipping.
67
         *
68
         * @param \Eccube\Entity\Shipping $Shipping
69
         *
70
         * @return \Eccube\Entity\CustomerAddress
71
         */
72 View Code Duplication
        public function setFromShipping(Shipping $Shipping)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
73
        {
74
            $this
75
            ->setName01($Shipping->getName01())
76
            ->setName02($Shipping->getName02())
77
            ->setKana01($Shipping->getKana01())
78
            ->setKana02($Shipping->getKana02())
79
            ->setCompanyName($Shipping->getCompanyName())
80
            ->setPhoneNumber($Shipping->getPhoneNumber())
81
            ->setPostalCode($Shipping->getPostalCode())
82
            ->setPref($Shipping->getPref())
83
            ->setAddr01($Shipping->getAddr01())
84
            ->setAddr02($Shipping->getAddr02());
85
86
            return $this;
87
        }
88
89
        /**
90
         * @var int
91
         *
92
         * @ORM\Column(name="id", type="integer", options={"unsigned":true})
93
         * @ORM\Id
94
         * @ORM\GeneratedValue(strategy="IDENTITY")
95
         */
96
        private $id;
97
98
        /**
99
         * @var string|null
100
         *
101
         * @ORM\Column(name="name01", type="string", length=255)
102
         */
103
        private $name01;
104
105
        /**
106
         * @var string|null
107
         *
108
         * @ORM\Column(name="name02", type="string", length=255)
109
         */
110
        private $name02;
111
112
        /**
113
         * @var string|null
114
         *
115
         * @ORM\Column(name="kana01", type="string", length=255, nullable=true)
116
         */
117
        private $kana01;
118
119
        /**
120
         * @var string|null
121
         *
122
         * @ORM\Column(name="kana02", type="string", length=255, nullable=true)
123
         */
124
        private $kana02;
125
126
        /**
127
         * @var string|null
128
         *
129
         * @ORM\Column(name="company_name", type="string", length=255, nullable=true)
130
         */
131
        private $company_name;
132
133
        /**
134
         * @var string|null
135
         *
136
         * @ORM\Column(name="postal_code", type="string", length=8, nullable=true)
137
         */
138
        private $postal_code;
139
140
        /**
141
         * @var string|null
142
         *
143
         * @ORM\Column(name="addr01", type="string", length=255, nullable=true)
144
         */
145
        private $addr01;
146
147
        /**
148
         * @var string|null
149
         *
150
         * @ORM\Column(name="addr02", type="string", length=255, nullable=true)
151
         */
152
        private $addr02;
153
154
        /**
155
         * @var string|null
156
         *
157
         * @ORM\Column(name="phone_number", type="string", length=14, nullable=true)
158
         */
159
        private $phone_number;
160
161
        /**
162
         * @var \DateTime
163
         *
164
         * @ORM\Column(name="create_date", type="datetimetz")
165
         */
166
        private $create_date;
167
168
        /**
169
         * @var \DateTime
170
         *
171
         * @ORM\Column(name="update_date", type="datetimetz")
172
         */
173
        private $update_date;
174
175
        /**
176
         * @var \Eccube\Entity\Customer
177
         *
178
         * @ORM\ManyToOne(targetEntity="Eccube\Entity\Customer", inversedBy="CustomerAddresses")
179
         * @ORM\JoinColumns({
180
         *   @ORM\JoinColumn(name="customer_id", referencedColumnName="id")
181
         * })
182
         */
183
        private $Customer;
184
185
        /**
186
         * @var \Eccube\Entity\Master\Country
187
         *
188
         * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\Country")
189
         * @ORM\JoinColumns({
190
         *   @ORM\JoinColumn(name="country_id", referencedColumnName="id")
191
         * })
192
         */
193
        private $Country;
194
195
        /**
196
         * @var \Eccube\Entity\Master\Pref
197
         *
198
         * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\Pref")
199
         * @ORM\JoinColumns({
200
         *   @ORM\JoinColumn(name="pref_id", referencedColumnName="id")
201
         * })
202
         */
203
        private $Pref;
204
205
        /**
206
         * Get id.
207
         *
208
         * @return int
209
         */
210 7
        public function getId()
211
        {
212 7
            return $this->id;
213
        }
214
215
        /**
216
         * Set name01.
217
         *
218
         * @param string|null $name01
219
         *
220
         * @return CustomerAddress
221
         */
222 45
        public function setName01($name01 = null)
223
        {
224 45
            $this->name01 = $name01;
225
226 45
            return $this;
227
        }
228
229
        /**
230
         * Get name01.
231
         *
232
         * @return string|null
233
         */
234 43
        public function getName01()
235
        {
236 43
            return $this->name01;
237
        }
238
239
        /**
240
         * Set name02.
241
         *
242
         * @param string|null $name02
243
         *
244
         * @return CustomerAddress
245
         */
246 45
        public function setName02($name02 = null)
247
        {
248 45
            $this->name02 = $name02;
249
250 45
            return $this;
251
        }
252
253
        /**
254
         * Get name02.
255
         *
256
         * @return string|null
257
         */
258 42
        public function getName02()
259
        {
260 42
            return $this->name02;
261
        }
262
263
        /**
264
         * Set kana01.
265
         *
266
         * @param string|null $kana01
267
         *
268
         * @return CustomerAddress
269
         */
270 44
        public function setKana01($kana01 = null)
271
        {
272 44
            $this->kana01 = $kana01;
273
274 44
            return $this;
275
        }
276
277
        /**
278
         * Get kana01.
279
         *
280
         * @return string|null
281
         */
282 42
        public function getKana01()
283
        {
284 42
            return $this->kana01;
285
        }
286
287
        /**
288
         * Set kana02.
289
         *
290
         * @param string|null $kana02
291
         *
292
         * @return CustomerAddress
293
         */
294 44
        public function setKana02($kana02 = null)
295
        {
296 44
            $this->kana02 = $kana02;
297
298 44
            return $this;
299
        }
300
301
        /**
302
         * Get kana02.
303
         *
304
         * @return string|null
305
         */
306 42
        public function getKana02()
307
        {
308 42
            return $this->kana02;
309
        }
310
311
        /**
312
         * Set companyName.
313
         *
314
         * @param string|null $companyName
315
         *
316
         * @return CustomerAddress
317
         */
318 34
        public function setCompanyName($companyName = null)
319
        {
320 34
            $this->company_name = $companyName;
321
322 34
            return $this;
323
        }
324
325
        /**
326
         * Get companyName.
327
         *
328
         * @return string|null
329
         */
330 42
        public function getCompanyName()
331
        {
332 42
            return $this->company_name;
333
        }
334
335
        /**
336
         * Set postal_code.
337
         *
338
         * @param string|null $postal_code
339
         *
340
         * @return CustomerAddress
341
         */
342 45
        public function setPostalCode($postal_code = null)
343
        {
344 45
            $this->postal_code = $postal_code;
345
346 45
            return $this;
347
        }
348
349
        /**
350
         * Get postal_code.
351
         *
352
         * @return string|null
353
         */
354 42
        public function getPostalCode()
355
        {
356 42
            return $this->postal_code;
357
        }
358
359
        /**
360
         * Set addr01.
361
         *
362
         * @param string|null $addr01
363
         *
364
         * @return CustomerAddress
365
         */
366 44
        public function setAddr01($addr01 = null)
367
        {
368 44
            $this->addr01 = $addr01;
369
370 44
            return $this;
371
        }
372
373
        /**
374
         * Get addr01.
375
         *
376
         * @return string|null
377
         */
378 43
        public function getAddr01()
379
        {
380 43
            return $this->addr01;
381
        }
382
383
        /**
384
         * Set addr02.
385
         *
386
         * @param string|null $addr02
387
         *
388
         * @return CustomerAddress
389
         */
390 44
        public function setAddr02($addr02 = null)
391
        {
392 44
            $this->addr02 = $addr02;
393
394 44
            return $this;
395
        }
396
397
        /**
398
         * Get addr02.
399
         *
400
         * @return string|null
401
         */
402 43
        public function getAddr02()
403
        {
404 43
            return $this->addr02;
405
        }
406
407
        /**
408
         * Set phone_number.
409
         *
410
         * @param string|null $phone_number
411
         *
412
         * @return CustomerAddress
413
         */
414 43
        public function setPhoneNumber($phone_number = null)
415
        {
416 43
            $this->phone_number = $phone_number;
417
418 43
            return $this;
419
        }
420
421
        /**
422
         * Get phone_number.
423
         *
424
         * @return string|null
425
         */
426 42
        public function getPhoneNumber()
427
        {
428 42
            return $this->phone_number;
429
        }
430
431
        /**
432
         * Set createDate.
433
         *
434
         * @param \DateTime $createDate
435
         *
436
         * @return CustomerAddress
437
         */
438 17
        public function setCreateDate($createDate)
439
        {
440 17
            $this->create_date = $createDate;
441
442 17
            return $this;
443
        }
444
445
        /**
446
         * Get createDate.
447
         *
448
         * @return \DateTime
449
         */
450
        public function getCreateDate()
451
        {
452
            return $this->create_date;
453
        }
454
455
        /**
456
         * Set updateDate.
457
         *
458
         * @param \DateTime $updateDate
459
         *
460
         * @return CustomerAddress
461
         */
462 17
        public function setUpdateDate($updateDate)
463
        {
464 17
            $this->update_date = $updateDate;
465
466 17
            return $this;
467
        }
468
469
        /**
470
         * Get updateDate.
471
         *
472
         * @return \DateTime
473
         */
474
        public function getUpdateDate()
475
        {
476
            return $this->update_date;
477
        }
478
479
        /**
480
         * Set customer.
481
         *
482
         * @param \Eccube\Entity\Customer|null $customer
483
         *
484
         * @return CustomerAddress
485
         */
486 37
        public function setCustomer(\Eccube\Entity\Customer $customer = null)
487
        {
488 37
            $this->Customer = $customer;
489
490 37
            return $this;
491
        }
492
493
        /**
494
         * Get customer.
495
         *
496
         * @return \Eccube\Entity\Customer|null
497
         */
498 2
        public function getCustomer()
499
        {
500 2
            return $this->Customer;
501
        }
502
503
        /**
504
         * Set country.
505
         *
506
         * @param \Eccube\Entity\Master\Country|null $country
507
         *
508
         * @return CustomerAddress
509
         */
510
        public function setCountry(\Eccube\Entity\Master\Country $country = null)
511
        {
512
            $this->Country = $country;
513
514
            return $this;
515
        }
516
517
        /**
518
         * Get country.
519
         *
520
         * @return \Eccube\Entity\Master\Country|null
521
         */
522
        public function getCountry()
523
        {
524
            return $this->Country;
525
        }
526
527
        /**
528
         * Set pref.
529
         *
530
         * @param \Eccube\Entity\Master\Pref|null $pref
531
         *
532
         * @return CustomerAddress
533
         */
534 44
        public function setPref(\Eccube\Entity\Master\Pref $pref = null)
535
        {
536 44
            $this->Pref = $pref;
537
538 44
            return $this;
539
        }
540
541
        /**
542
         * Get pref.
543
         *
544
         * @return \Eccube\Entity\Master\Pref|null
545
         */
546 43
        public function getPref()
547
        {
548 43
            return $this->Pref;
549
        }
550
    }
551
}
552