public static function setApplicationDocumentManager(Application $application, $dmName)
 {
     $service = null === $dmName ? 'doctrine_phpcr.odm.document_manager' : 'doctrine_phpcr.odm.' . $dmName . '_document_manager';
     $documentManager = $application->getKernel()->getContainer()->get($service);
     $helperSet = $application->getHelperSet();
     $helperSet->set(new DocumentManagerHelper(null, $documentManager));
 }
Exemplo n.º 2
0
 public function load(Application $application)
 {
     $in = $this->container->getParameter('seed.directory');
     //add seed:load and seed:unload commands
     $application->add($this->container->get('seed.load_seeds_command'));
     $application->add($this->container->get('seed.unload_seeds_command'));
     //Go through bundles and add *Seeds available in seed.directory
     foreach ($application->getKernel()->getBundles() as $bundle) {
         if (!is_dir($dir = sprintf('%s/%s', $bundle->getPath(), $in))) {
             continue;
         }
         $finder = new Finder();
         $finder->files()->name('*Seed.php')->in($dir);
         $prefix = $bundle->getNameSpace() . '\\' . strtr($in, '/', '\\');
         foreach ($finder as $file) {
             $ns = $prefix;
             if ($relativePath = $file->getRelativePath()) {
                 $ns .= '\\' . strtr($relativePath, '/', '\\');
             }
             $class = $ns . '\\' . $file->getBasename('.php');
             $alias = 'seed.command.' . strtolower(str_replace('\\', '_', $class));
             if ($this->container->has($alias)) {
                 continue;
             }
             $r = new \ReflectionClass($class);
             if ($r->isSubclassOf('Soyuka\\SeedBundle\\Command\\Seed') && !$r->isAbstract() && ($r->hasMethod('load') || $r->hasMethod('unload'))) {
                 $application->add($r->newInstanceArgs([$this->prefix, $this->separator]));
             }
         }
     }
 }
Exemplo n.º 3
0
 public function registerCommands(Application $application)
 {
     $container = $application->getKernel()->getContainer();
     $commands = $container->getParameter('swarrot.commands');
     foreach ($commands as $command) {
         $application->add($container->get($command));
     }
 }
Exemplo n.º 4
0
 public function registerCommands(Application $application)
 {
     $config = $application->getKernel()->getContainer()->getParameter('mongrate_bundle');
     $application->add(new \Mongrate\MongrateBundle\Command\ToggleMigrationCommand($config));
     $application->add(new \Mongrate\MongrateBundle\Command\GenerateMigrationCommand($config));
     $application->add(new \Mongrate\MongrateBundle\Command\UpCommand($config));
     $application->add(new \Mongrate\MongrateBundle\Command\DownCommand($config));
     $application->add(new \Mongrate\MongrateBundle\Command\ListCommand($config));
     $application->add(new \Mongrate\MongrateBundle\Command\TestCommand($config));
 }
Exemplo n.º 5
0
 public static function setApplicationConnection(Application $application, $connName)
 {
     $connection = $application->getKernel()->getContainer()->get('doctrine')->getConnection($connName);
     $helperSet = $application->getHelperSet();
     $helperSet->set(new ConnectionHelper($connection), 'db');
 }
Exemplo n.º 6
0
 public function registerCommands(Application $application)
 {
     /** @var $application FrameworkApplication */
     $container = $application->getKernel()->getContainer();
     $application->add($container->get('maxmode_generator.sonata_admin.generator'));
 }
 public static function setApplicationDocumentManager(Application $application, $dmName)
 {
     $documentManager = $application->getKernel()->getContainer()->get('doctrine_couchdb.odm.' . $dmName . '_document_manager');
     $helperSet = $application->getHelperSet();
     $helperSet->set(new CouchDBHelper(null, $documentManager));
 }