/**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     $this->app->bindShared('analogue', function ($app) {
         $db = $app['db'];
         $connectionProvider = new IlluminateConnectionProvider($db);
         $illuminate = new IlluminateDriver($connectionProvider);
         $driverManager = new DriverManager();
         $driverManager->addDriver($illuminate);
         $event = $app->make('events');
         return new Manager($driverManager, $event);
     });
 }
Exemplo n.º 2
0
 /**
  * Return a new Mapper instance
  * 
  * @param  string       $entityClass 
  * @param  string       $entityMap
  * @return Mapper                     
  */
 public function make($entityClass, EntityMap $entityMap)
 {
     $driver = $entityMap->getDriver();
     $connection = $entityMap->getConnection();
     $adapter = $this->drivers->getAdapter($driver, $connection);
     $entityMap->setDateFormat($adapter->getDateFormat());
     $mapper = new Mapper($entityMap, $adapter, $this->dispatcher, $this->manager);
     // Fire Initializing Event
     $mapper->fireEvent('initializing', $mapper);
     $mapInitializer = new MapInitializer($entityMap);
     $mapInitializer->init();
     // Fire Initialized Event
     $mapper->fireEvent('initialized', $mapper);
     return $mapper;
 }
Exemplo n.º 3
0
 /**
  * Boot Analogue
  *
  * @return Analogue
  */
 public function boot()
 {
     if (static::$booted) {
         return $this;
     }
     $dispatcher = new Dispatcher();
     $connectionProvider = new CapsuleConnectionProvider(static::$capsule);
     $illuminate = new IlluminateDriver($connectionProvider);
     $driverManager = new DriverManager();
     $driverManager->addDriver($illuminate);
     static::$manager = new Manager($driverManager, $dispatcher);
     static::$instance = $this;
     static::$booted = true;
     return $this;
 }