objConnection = new PDO( 'mysql:host=127.0.0.1;dbname=semana-de-extensao;charset=UTF-8', 'root', '123456' ); $this->objConnection->beginTransaction(); } public function __destruct() { $this->objConnection->commit(); } /** * * @param string $strSql * @return boolean|array */ public function run( $strSql , $arrParams = array() ) { $objPrepare = $this->objConnection->prepare( $strSql ); $objPrepare->execute( $arrParams ); $arrResult = $objPrepare->fetchAll(); return $arrResult; } } class DrawFlow { protected $arrStates; protected $arrLines; public function getStates() { if( $this->arrStates == null ) { $strSql = "select * from tb_situacao_atividade order by id_situacao_atividade "; $this->arrStates = DatabaseConnection::getInstance()->run( $strSql ); } return $this->arrStates; } public function getLines() { if( $this->arrLines == null ) { $strSql = "select * from tb_acao_em_atividade order by id_acao_em_atividade "; $this->arrLines = DatabaseConnection::getInstance()->run( $strSql ); } return $this->arrLines; } } $objDrawFlow = new DrawFlow(); ?>