/** * {@inheritdoc} */ protected function doGenerate(ClassMetadata $metadata, array $data, array $options = array()) { static $docBlock; if (empty($docBlock)) { $writer = new Writer(); $writer->writeln('/**')->writeln(' * This code was generated automatically by the FixtureDumper library, manual changes to it')->writeln(' * may be lost upon next generation.')->writeln(' */'); $docBlock = $writer->getContent(); } $fixtureClass = new PhpClass($options['namespace'] . '\\' . $this->namingStrategy->fixtureName($metadata)); $fixtureClass->setDocblock($docBlock); $fixtureClass->setParentClassName('Doctrine\\Common\\DataFixtures\\AbstractFixture'); $fixtureClass->addUseStatement($metadata->getName()); if (count($metadata->getAssociationNames()) !== 0) { $this->addDependentFixtureInterface($fixtureClass, $metadata, $options); } $this->generateLoadMethod($fixtureClass, $metadata, $data); $generator = new DefaultGeneratorStrategy(); $content = $generator->generate($fixtureClass); return $content; }