strTableName = $strTableName; try { R::setup( 'mysql:host=' . $objConfig->getHost() . ';dbname=' . $objConfig->getName(), $objConfig->getUser(), $objConfig->getPassword() ); } catch (Exception $ex) { alert($ex->getMessage(), 1); } } ///// PUBLIC METHODS ////////////////////////////////////////////////////////////////////////////// /** * Counts the number of rows in the given table. * The RedBeans function have strict limitations * therefore an array function was used and the received array was converted into an integer. * * @return integer Returns the number of rows in the table */ public function getRowCount() { try { $arrResult = R::getAssoc('SELECT COUNT(*) FROM ' . strtolower($this->strTableName)); $intReturnValue = array_values($arrResult)[0]; return (int)$intReturnValue; } catch (Exception $ex) { alert($ex, 1); die(); } } /** * Gets the newest entry of the given table. * * @param string $strChangeDateColumn The name of the column where the changedate is located * @return array Returns the entry as array */ public function getNewestEntryDate(string $strChangeDateColumn) { try { $arrResult = R::getAssoc('SELECT ' . $strChangeDateColumn . ' FROM ' . $this->strTableName . ' ORDER BY ' . $this->strTableName . '.' . $strChangeDateColumn . ' DESC LIMIT 0,1'); $strNewestDate = array_values($arrResult)[0]; return $strNewestDate; } catch (Exception $ex) { alert($ex, 1); die(); } } }