Example #1
0
 private function setModelAttributes($model)
 {
     $this->setModelClass(Inflector::getClassNameFromNamespace($model));
     if (!property_exists($model, 'tableName') || is_null($this->tableName)) {
         $this->setTableName(Inflector::tabilize($this->getModelClass()));
     }
     if (!property_exists($model, 'database') || is_null($this->database)) {
         $this->setDatabase(Connection::getDefaultConnection());
     } else {
         $this->setDatabase($this->database);
     }
     if (is_null($this->getDatabase())) {
         throw new \InvalidArgumentException("Please specify database name in your model. " . get_called_class());
     }
     $this->setPrimarykey();
 }
Example #2
0
 /**
  * We will set Database Connection object
  *
  * @param $connection
  */
 public function setDatabaseConnection($connection)
 {
     $this->pdo[$connection] = Connection::getConnection($connection);
 }
 /**
  * @param $input
  * @return mixed
  */
 private function getDatabase($input)
 {
     return $input->getArgument('database') != '' ? $input->getArgument('database') : Connection::getDefaultConnection();
 }
Example #4
0
 /**
  * Set the database connection
  *
  * @param $database
  */
 public function setConn($database)
 {
     $this->_connection = Connection::getConnection($database);
 }
Example #5
0
 public function getDefaultDatabaseConnection()
 {
     return Connection::getDefaultConnection();
 }