Created
June 8, 2011 10:57
-
-
Save makasim/1014202 to your computer and use it in GitHub Desktop.
Symfony2 Command and logging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected function execute(InputInterface $input, OutputInterface $output) | |
{ | |
$fixtureDir = \APPLICATION_PATH . '/' . $input->getArgument('dir'); | |
if (!\is_dir($fixtureDir)) { | |
throw new \Exception('The fixture dir `'.$fixtureDir.'` is not exist.'); | |
} | |
$loader = new Loader(); | |
$loader->loadFromDirectory($fixtureDir); | |
$executor = new ORMExecutor(\Zend_Registry::get('em'), new ORMPurger()); | |
$executor->setLogger(function($msg) use ($output) { | |
$output->writeln($msg); | |
}); | |
$executor->execute($loader->getFixtures()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment