ForkCMS\Bundle\InstallerBundle\Entity\InstallationData::getDbUsername PHP Метод

getDbUsername() публичный Метод

Gets the The username for the database.
public getDbUsername ( ) : string
Результат string
    public function getDbUsername()
    {
        return $this->dbUsername;
    }

Usage Example

Пример #1
0
 /**
  * Validate if a database connection can be made
  *
  * @param InstallationData          $data    The form data
  * @param ExecutionContextInterface $context The forms validation context
  *
  * @todo   Replace SpoonDatabase
  */
 public function checkDatabaseConnection(InstallationData $data, ExecutionContextInterface $context)
 {
     try {
         // create instance
         $db = new \SpoonDatabase('mysql', $data->getDbHostname(), $data->getDbUsername(), $data->getDbPassword(), $data->getDbDatabase(), $data->getDbPort());
         // test table
         $table = 'test' . time();
         // attempt to create table
         $db->execute('DROP TABLE IF EXISTS ' . $table);
         $db->execute('CREATE TABLE ' . $table . ' (id int(11) NOT NULL) ENGINE=MyISAM');
         // drop table
         $db->drop($table);
     } catch (\Exception $e) {
         $context->addViolation('Problem with database credentials');
     }
 }
All Usage Examples Of ForkCMS\Bundle\InstallerBundle\Entity\InstallationData::getDbUsername