public function bootPackageEntityManager(Package $p)
 {
     $configUpdater = new EntityManagerConfigUpdater($this->entityManager);
     $providerFactory = new PackageProviderFactory($this->application, $p);
     $provider = $providerFactory->getEntityManagerProvider();
     $configUpdater->addProvider($provider);
 }
Beispiel #2
0
 /**
  * Create a entity manager used for the package installation,
  * update and unistall process.
  *
  * @return \Doctrine\ORM\EntityManager
  */
 public function getPackageEntityManager()
 {
     $providerFactory = new PackageProviderFactory($this->app, $this);
     $provider = $providerFactory->getEntityManagerProvider();
     $drivers = $provider->getDrivers();
     if (count($drivers)) {
         $config = Setup::createConfiguration(true, $this->app->make('config')->get('database.proxy_classes'));
         $driverImpl = new MappingDriverChain();
         $coreDriver = new CoreDriver($this->app);
         // Add the core driver to it so packages can extend the core and not break.
         $driverImpl->addDriver($coreDriver->getDriver(), $coreDriver->getNamespace());
         foreach ($drivers as $driver) {
             $driverImpl->addDriver($driver->getDriver(), $driver->getNamespace());
         }
         $config->setMetadataDriverImpl($driverImpl);
         $em = EntityManager::create(\Database::connection(), $config);
         return $em;
     }
 }