Example #1
0
 public function test_can_extend_all_connections()
 {
     $this->registry->shouldReceive('getManagerNames')->once()->andReturn(['default', 'custom']);
     $this->registry->shouldReceive('getManager')->once()->with('default')->andReturn($this->em);
     $this->registry->shouldReceive('getManager')->once()->with('custom')->andReturn($this->em);
     $this->em->shouldReceive('getConfiguration')->twice()->andReturn(m::mock(Configuration::class));
     $this->em->shouldReceive('getConnection')->twice()->andReturn(m::mock(Connection::class));
     $this->em->shouldReceive('getEventManager')->twice()->andReturn(m::mock(EventManager::class));
     $this->manager->extendAll(function ($configuration, $connection, $eventManager) {
         $this->assertExtendedCorrectly($configuration, $connection, $eventManager);
     });
 }
 /**
  * Register the metadata
  *
  * @param DoctrineManager $manager
  */
 public function boot(DoctrineManager $manager)
 {
     $manager->extendAll(function (Configuration $configuration) {
         $configuration->setCustomDatetimeFunctions($this->datetime);
         $configuration->setCustomNumericFunctions($this->numeric);
         $configuration->setCustomStringFunctions($this->string);
     });
 }
Example #3
0
 /**
  * @param DoctrineManager   $manager
  * @param Gate              $gate
  * @param PermissionManager $permissionManager
  */
 public function boot(DoctrineManager $manager, Gate $gate, PermissionManager $permissionManager)
 {
     if (!$this->isLumen()) {
         $this->publishes([$this->getConfigPath() => config_path('acl.php')], 'config');
     }
     $manager->extendAll(RegisterMappedEventSubscribers::class);
     if ($permissionManager->needsDoctrine()) {
         $manager->addPaths([__DIR__ . DIRECTORY_SEPARATOR . 'Permissions']);
     }
     $this->definePermissions($gate, $permissionManager);
 }
Example #4
0
 /**
  * 
  *
  * @param string|callable $callback
  * @static 
  */
 public static function extendAll($callback)
 {
     return \LaravelDoctrine\ORM\DoctrineManager::extendAll($callback);
 }