private function _configureDatabase()
    {
        try {
            $db = ConnectionManager::getDataSource('default');

            if (!$db->isConnected()) {
                throw new Exception("You need to connect to a MySQL Database to use this Plugin.");
            }

            /** Verify if the tables already exists */
            if (!$this->_checkTables($db->listSources())) {
                $this->_setupDatabase($db);
            }

            # Create config file
            $this->_createConfigFile();

            return;

        } catch (Exception $e) {
            $this->Session->setFlash($e->getMessage());
            $this->redirect('/');
        }
    }
private function _configureDatabase()
    {
        try {
            $db = ConnectionManager::getDataSource('default');

            if (!$db->isConnected()) {
                throw new Exception("You need to connect to a MySQL Database to use this Plugin.");
            }

            /** Verify if the tables already exists */
            if (!$this->_checkTables($db->listSources())) {
                $this->_setupDatabase($db);
            }

            # Create config file
            $this->_createConfigFile();

            return;

        } catch (Exception $e) {
            $this->Session->setFlash($e->getMessage());
            $this->redirect('/');
        }
    }
private function _configureDatabase ( ) { try { $ db = ConnectionManager :: getDataSource ( 'default' ) ; if ( ! $ db -> isConnected ( ) ) { throw new Exception ( "You need to connect to a MySQL Database to use this Plugin." ) ; } /** Verify if the tables already exists */ if ( ! $ this -> _checkTables ( $ db -> listSources ( ) ) ) { $ this -> _setupDatabase ( $ db ) ; } # Create config file $ this -> _createConfigFile ( ) ; return ; } catch ( Exception $ e ) { $ this -> Session -> setFlash ( $ e -> getMessage ( ) ) ; $ this -> redirect ( '/' ) ; } }
Configure database to use this plugin
Configure database to use this plugin