Exemplo n.º 1
0
Arquivo: DJJob.php Projeto: qoqa/djjob
 public static function configure($dsn, $options = array())
 {
     self::$dsn = $dsn;
     self::$options = array_merge(self::$options, $options);
 }
Exemplo n.º 2
0
 protected static function configureWithOptions(array $options, $jobsTable = 'jobs')
 {
     if (!isset($options['driver'])) {
         throw new DJException("Please provide the database driver used in configure options array.");
     }
     if (!isset($options['user'])) {
         throw new DJException("Please provide the database user in configure options array.");
     }
     if (!isset($options['password'])) {
         throw new DJException("Please provide the database password in configure options array.");
     }
     self::$user = $options['user'];
     self::$password = $options['password'];
     self::$jobsTable = $jobsTable;
     self::$dsn = $options['driver'] . ':';
     foreach ($options as $key => $value) {
         // skips options already used
         if ($key == 'driver' || $key == 'user' || $key == 'password') {
             continue;
         }
         // searches for retries
         if ($key == 'retries') {
             self::$retries = (int) $value;
             continue;
         }
         self::$dsn .= $key . '=' . $value . ';';
     }
 }
Exemplo n.º 3
0
 public static function configure($dsn)
 {
     self::$dsn = $dsn;
 }