|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* LoadSupplierData Données de l'application GLSR. |
|
4
|
|
|
* |
|
5
|
|
|
* PHP Version 7 |
|
6
|
|
|
* |
|
7
|
|
|
* @author Quétier Laurent <[email protected]> |
|
8
|
|
|
* @copyright 2018 Dev-Int GLSR |
|
9
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License |
|
10
|
|
|
* |
|
11
|
|
|
* @version GIT: $Id$ |
|
12
|
|
|
* |
|
13
|
|
|
* @see https://github.com/Dev-Int/glsr |
|
14
|
|
|
*/ |
|
15
|
|
|
|
|
16
|
|
|
namespace App\DataFixtures\ORM; |
|
17
|
|
|
|
|
18
|
|
|
use Doctrine\Common\DataFixtures\AbstractFixture; |
|
19
|
|
|
use Doctrine\Common\DataFixtures\OrderedFixtureInterface; |
|
20
|
|
|
use Doctrine\Common\Persistence\ObjectManager; |
|
21
|
|
|
use App\Entity\Settings\Supplier; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* Load Supplier Data. |
|
25
|
|
|
* |
|
26
|
|
|
* @category DataFixtures |
|
27
|
|
|
*/ |
|
28
|
|
|
class LoadSupplierData extends AbstractFixture implements OrderedFixtureInterface |
|
29
|
|
|
{ |
|
30
|
|
|
/** |
|
31
|
|
|
* Load data fixtures with the passed EntityManager. |
|
32
|
|
|
* |
|
33
|
|
|
* @param ObjectManager $manager |
|
34
|
|
|
*/ |
|
35
|
|
|
public function load(ObjectManager $manager) |
|
36
|
|
|
{ |
|
37
|
|
|
// Serialisation des numéros de téléphone |
|
38
|
|
|
$phoneUtil = \libphonenumber\PhoneNumberUtil::getInstance(); |
|
39
|
|
|
// Références des catégories |
|
40
|
|
|
$surgele = $this->getReference('family-log3'); |
|
41
|
|
|
$frais = $this->getReference('family-log4'); |
|
42
|
|
|
$sec = $this->getReference('family-log5'); |
|
43
|
|
|
$boissons = $this->getReference('family-log6'); |
|
44
|
|
|
// Datas des suppliers |
|
45
|
|
|
$datas = [ |
|
46
|
|
|
['name' => 'Davigel', 'address' => '12, rue du gel', 'zipCode' => 75001, |
|
47
|
|
|
'town' => 'Paris', 'phone' => $phoneUtil->parse('0140000001', 'FR'), |
|
48
|
|
|
'fax' => $phoneUtil->parse('0140000001', 'FR'), |
|
49
|
|
|
'mail' => '[email protected]', 'contact' => 'David Gel', |
|
50
|
|
|
'gsm' => $phoneUtil->parse('0160000001', 'FR'), 'family' => $surgele, |
|
51
|
|
|
'delayDeliv' => 2, 'orderDate' => [2, 5], ], |
|
52
|
|
|
['name' => 'Davifrais', 'address' => '12, rue du frais', |
|
53
|
|
|
'zipCode' => 75001, 'town' => 'Paris', |
|
54
|
|
|
'phone' => $phoneUtil->parse('0140000002', 'FR'), |
|
55
|
|
|
'fax' => $phoneUtil->parse('0140000002', 'FR'), |
|
56
|
|
|
'mail' => '[email protected]', 'contact' => 'David Frais', |
|
57
|
|
|
'gsm' => $phoneUtil->parse('0160000002', 'FR'), 'family' => $frais, |
|
58
|
|
|
'delayDeliv' => 2, 'orderDate' => [2, 5], ], |
|
59
|
|
|
['name' => 'Davisec', 'address' => '12, rue du sec', 'zipCode' => 75001, |
|
60
|
|
|
'town' => 'Paris', 'phone' => $phoneUtil->parse('0140000003', 'FR'), |
|
61
|
|
|
'fax' => $phoneUtil->parse('0140000003', 'FR'), |
|
62
|
|
|
'mail' => '[email protected]', 'contact' => 'David Sec', |
|
63
|
|
|
'gsm' => $phoneUtil->parse('0160000003', 'FR'), 'family' => $sec, |
|
64
|
|
|
'delayDeliv' => 3, 'orderDate' => [3], ], |
|
65
|
|
|
['name' => 'Loire Boissons', 'address' => '12, rue de la soif', |
|
66
|
|
|
'zipCode' => 75001, 'town' => 'Paris', |
|
67
|
|
|
'phone' => $phoneUtil->parse('0140000004', 'FR'), |
|
68
|
|
|
'fax' => $phoneUtil->parse('0140000004', 'FR'), |
|
69
|
|
|
'mail' => '[email protected]', 'contact' => 'David Sec', |
|
70
|
|
|
'gsm' => $phoneUtil->parse('0160000004', 'FR'), 'family' => $boissons, |
|
71
|
|
|
'delayDeliv' => 3, 'orderDate' => [5], ], |
|
72
|
|
|
]; |
|
73
|
|
|
|
|
74
|
|
|
foreach ($datas as $key => $data) { |
|
75
|
|
|
$supplier = new Supplier(); |
|
76
|
|
|
$supplier->setName($data['name']) |
|
77
|
|
|
->setAddress($data['address']) |
|
78
|
|
|
->setZipCode($data['zipCode']) |
|
79
|
|
|
->setTown($data['town']) |
|
80
|
|
|
->setPhone($data['phone']) |
|
81
|
|
|
->setFax($data['fax']) |
|
82
|
|
|
->setMail($data['mail']) |
|
|
|
|
|
|
83
|
|
|
->setContact($data['contact']) |
|
84
|
|
|
->setGsm($data['gsm']) |
|
85
|
|
|
->setFamilyLog($data['family']) |
|
86
|
|
|
->setDelaydeliv($data['delayDeliv']) |
|
87
|
|
|
->setOrderdate($data['orderDate']); |
|
88
|
|
|
|
|
89
|
|
|
$manager->persist($supplier); |
|
90
|
|
|
$order = $key + 1; |
|
91
|
|
|
$this->addReference('supplier'.$order, $supplier); |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
$manager->flush(); |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* Get the order of this fixture. |
|
99
|
|
|
* |
|
100
|
|
|
* @return int |
|
101
|
|
|
*/ |
|
102
|
|
|
public function getOrder() |
|
103
|
|
|
{ |
|
104
|
|
|
return 5; |
|
105
|
|
|
} |
|
106
|
|
|
} |
|
107
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.