J'ai un souci avec ce code dans mon application faite avec symfony 2
J' informe aussi que le DataFixtureBunlde est enregistrée dans le appkernel.php
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 namespace Immobilier\GestionBundle\DataFixtures\ORM; use Doctrine\Common\DataFixtures\FixtureInterface; use Doctrine\Common\Persistence\ObjectManager; use Immobilier\GestionBundle\Entity\Commune; class Communes implements FixtureInterface { public function load(ObjetManager $manager) { $noms= array("commune1","commune2"); foreach($noms as $key => $nom) { $liste_ommune[$key] = new Commune(); $liste_ommune[$key]->setNomcommune($nom); $manager->persist($liste_ommune[$key]); } $manager->flush(); } //put your code here }
Voici donc l'erreur qui surgit quand je lance la commande
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 class AppKernel extends Kernel { public function registerBundles() { $bundles = array( new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new Symfony\Bundle\SecurityBundle\SecurityBundle(), new Symfony\Bundle\TwigBundle\TwigBundle(), new Symfony\Bundle\MonologBundle\MonologBundle(), new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(), new Immobilier\GestionBundle\ImmobilierGestionBundle(), ); if (in_array($this->getEnvironment(), array('dev', 'test'), true)) { $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle(); $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(); $bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(); } return $bundles; }
Code : Sélectionner tout - Visualiser dans une fenêtre à part php app/console doctrine:fixture:loadMerci de m'aider à solutionner.$ php app/console doctrine:fixture:load
Careful, database will be purged. Do you want to continue y/N ?y
PHP Fatal error: Declaration of Immobilier\GestionBundle\DataFixtures\ORM\Communes::load(Immobilier\GestionBundle\DataFixtures\ORM\ObjetManager $manager) must be compatible with Doctrine\Common\DataFixtures\FixtureInterface::load(Doctrine\Common\Persistence\ObjectManager $manager) in /home/prolifiik/Agence immobiliere/src/Immobilier/GestionBundle/DataFixtures/ORM/Communes.php on line 21
[Symfony\Component\Debug\Exception\FatalErrorException]
Compile Error: Declaration of Immobilier\GestionBundle\DataFixtures\ORM\Communes::load(Immobilier\GestionBundle\DataFixtures\ORM\ObjetManager $manager) must be
compatible with Doctrine\Common\DataFixtures\FixtureInterface::load(Doctrine\Common\Persistence\ObjectManager $manager)
doctrine:fixtures:load [--fixtures [FIXTURES]] [--append] [--em EM] [--shard SHARD] [--purge-with-truncate] [--multiple-transactions] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-s|--shell] [--process-isolation] [-e|--env ENV] [--no-debug] [--] <command>
Partager