예제 #1
0
 /**
  * OpeС‚s and creates XML DOM tree.
  *
  * Sets error for YMLParser if cannot open file or xml is invalid
  *
  * @param string $filename Path to file
  *
  * @throws \Exception Throws exception if file doesn't exist or its size = 0
  *
  * @return bool
  */
 public function open($filename)
 {
     if (file_exists($filename) === false || filesize($filename) === 0) {
         throw new \Exception("File: {$filename} does not exist or empty.");
     }
     return $this->driver->open($filename);
 }
예제 #2
0
 /**
  * @param array $parameters
  * @throws Exception\InvalidArgumentException
  * @return Platform\PlatformInterface
  */
 protected function createPlatform($parameters)
 {
     if (isset($parameters['platform'])) {
         $platformName = $parameters['platform'];
     } elseif ($this->driver instanceof Driver\DriverInterface) {
         $platformName = $this->driver->getDatabasePlatformName(Driver\DriverInterface::NAME_FORMAT_CAMELCASE);
     } else {
         throw new Exception\InvalidArgumentException('A platform could not be determined from the provided configuration');
     }
     $options = isset($parameters['platform_options']) ? $parameters['platform_options'] : array();
     switch ($platformName) {
         case 'Mysql':
             return new Platform\Mysql($options);
         default:
             return new Platform\Sql92($options);
     }
 }