2012-05-23 11 views
0

我无法启动我的简单Fixture,我以正确的方式安装了该软件包,并将2行放在autoload.php和Appkernel.php中,如here所述,并且然后,我创建我的夹具类,因为它遵循:DoctrineFixturesBundle:LoadRubricaData :: load()中的致命错误

<?php 

namespace ABCBundle\DataFixtures\ORM; 

use Doctrine\Common\DataFixtures\FixtureInterface; 
use ABCBundle\Entity\Rubrica; 

class LoadRubricaData implements FixtureInterface 
{ 
    public function load(ObjectManager $manager) 
    { 
     $rubrica = new Rubrica(); 
     $rubrica->setX("XXX"); 
     $manager->persist($rubrica); 
     $manager->flush(); 
    } 
} 
?> 

但是,当我尝试从CLI与

php app/console doctrine:fixtures:load

启动它,我得到:

Fatal error: Declaration of ABCBundle\DataFixtures\ORM\LoadRubricaData::load() must be compatible with that of Doctrine\Common\DataFixtures\FixtureInterface::load() in [...]ABCBundle/DataFixtures/ORM/LoadRubricaData.php on line 10

,但如果你去看看那个界面,你可以看到它是正确的:

interface FixtureInterface 
{ 
    /** 
    * Load data fixtures with the passed EntityManager 
    * 
    * @param Doctrine\Common\Persistence\ObjectManager $manager 
    */ 
    function load(ObjectManager $manager); 
} 

有什么不对?

回答

0

该死,我忘了添加行

use Doctrine\Common\Persistence\ObjectManager;