Hi i am having some trouble in a part to retrieve data from my database in order set a multi-language application, where i would on app start to redirect to the default language that i have predefined as a column as of type Bool/TinyINT, but as I connect and try to execute a statement to retrieve all the languages list in my database table it won’t return the results. Can someone help me here? Here is my class.
namespace Nanocord\Mvc;
// Load classes
use Laminas\Mvc\Application as LaminasApplication;
use Laminas\Db\Adapter\Adapter;
use Laminas\Db\Sql\Sql;
/**
* Application
*
* @category Nanocord
* @package Mvc
* @subpackage Application
*/
class Application extends LaminasApplication
{
private $config;
private $db;
private $isConnected;
private $sql;
public function __construct($config)
{
$this->config = $config;
}
public function start()
{
$application = parent::init($this->config)->run();
$db_config = $application->getConfig()['db'];
$db_adapter = new Adapter($db_config);
$db_adapter->driver->getConnection()->connect();
if ($db_adapter->driver->getConnection()->isConnected() === true) {
$this->db = $db_adapter;
$this->isConnected = true;
$this->sql = new Sql($this->db);
$this->initLanguage();
}
}
public function initLanguage()
{
$select = $this->sql->select();
$select->from('application_language');
$statement = $this->sql->prepareStatementForSqlObject($select);
$results = $statement->execute();
var_dump($results);
}
public function initSession()
{
}
}