Я создаю данные Doctrine, которым требуется функция загрузки.Я буквально скопировал метод из FixtureInterface.php, но каким-то образом load () моего прибора отличается.
PHP Fatal error: Declaration of PastonVerBundle\DataFixtures\ORM\LoadTimeZoneData::load() must be compatible with that of Doctrine\Common\DataFixtures\FixtureInterface::load() in /var/www/symfony/src/Paston/VerBundle/DataFixtures/ORM/LoadTimeZoneData.php on line 9
Моя загрузка:
<?php
namespace PastonVerBundle\DataFixtures\ORM;
use Doctrine\Common\DataFixtures\FixtureInterface;
use Paston\VerBundle\Entity\TimeZone;
class LoadTimeZoneData
implements FixtureInterface {
function load(ObjectManager $manager) {
$z = new \TimeZone();
$z->setName('Timezone');
$manager->persist($z);
$manager->flush();
}
}
?>
Загрузка из FixtureInterface.php
namespace Doctrine\Common\DataFixtures;
use Doctrine\Common\Persistence\ObjectManager;
/**
* Interface contract for fixture classes to implement.
*
* @author Jonathan H. Wage <jonwage@gmail.com>
*/
interface FixtureInterface
{
/**
* Load data fixtures with the passed EntityManager
*
* @param Doctrine\Common\Persistence\ObjectManager $manager
*/
function load(ObjectManager $manager);
}