Bonjour chers amis
Quelqu'un peut-il m'assister sur ce problème? je ne progresse plus. J'essaie de remplir les tables Ad (annonces) et Image (images liées aux annonces) avec des fausses données mais la commande n'aboutit pas. voir ci-dessous.
Ci-dessous la commande:
Et le code de la Fixture
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 C:\wamp64\www\Symfony\MonProjet>php -d memory_limit=1024M bin/console doctrine:fixtures:load --no-debug Careful, database "symbnb" will be purged. Do you want to continue? (yes/no) [no]: > yes > purging database > loading App\DataFixtures\AppFixtures Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 36864 bytes) in C:\wamp64\www\Symfony\MonProjet\vendor\cocur\slugify\src\Slugify.php on line 138 Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 32768 bytes) in C:\wamp64\www\Symfony\MonProjet\vendor\symfony\debug\Exception\OutOfMemoryException.ph p on line 1
Je vous dis merci par avance
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47 <?php namespace App\DataFixtures; use App\Entity\Ad; use Faker\Factory; use App\Entity\Image; use Doctrine\Bundle\FixturesBundle\Fixture; use Doctrine\Common\Persistence\ObjectManager; class AppFixtures extends Fixture { public function load(ObjectManager $manager) { $faker=Factory::create('fr-FR'); for ($i=1;$i=10;$i++){ $ad= new Ad; $title=$faker->sentence(); $coverImage=$faker->imageUrl(1000,350); $introduction=$faker->paragraph(2); $content='<p>'.join('</p><p>',$faker->paragraphs(5)).'</p>'; $ad->setTitle($title) ->setCoverImage($coverImage) ->setIntroduction($introduction) ->setContent($content) ->setPrice(mt_rand(4,20)) ->setRooms(mt_rand(1,5)); for($j=1; $j<=mt_rand(2,5); $j++){ $image= new Image(); $image->setUrl($faker->imageUrl()) ->setCaption($faker->sentence()) ->setAd($ad); $manager->persist($image); } $manager->persist($ad); } $manager->flush(); } }
Partager