Ejemplo n.º 1
0
 /**
  * @param Debugger           $debugger
  * @param ODM                $odm
  * @param ContainerInterface $container
  * @param ClassLocator       $locator
  */
 public function perform(Debugger $debugger, ODM $odm, ContainerInterface $container, ClassLocator $locator)
 {
     //We don't really need location errors here
     $locator->setLogger(new NullLogger());
     $benchmark = $debugger->benchmark($this, 'update');
     $builder = $odm->schemaBuilder($locator);
     //To make builder available for other commands (in sequence)
     $container->bind(get_class($builder), $builder);
     if (!$this->option('sync')) {
         $this->writeln("<comment>Silent mode on, no mongo indexes to be created.</comment>");
     }
     //Save and syncronize
     $odm->updateSchema($builder, $this->option('sync'));
     $elapsed = number_format($debugger->benchmark($this, $benchmark), 3);
     $countModels = count($builder->getDocuments());
     $this->write("<info>ODM Schema has been updated: <comment>{$elapsed} s</comment>");
     $this->writeln(", found documents: <comment>{$countModels}</comment></info>");
 }
Ejemplo n.º 2
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $builder = $this->odm->updateSchema(null, true);
     $countModels = count($builder->getDocuments());
     $this->info("<info>ODM Schema has been updated, found documents: <comment>{$countModels}</comment></info>");
 }