Пример #1
0
 /**
  * (non-PHPdoc).
  *
  * @see Alpha\Model\ActiveRecordProviderInterface::getMAX()
  */
 public function getMAX()
 {
     self::$logger->debug('>>getMAX()');
     $sqlQuery = 'SELECT MAX(OID) AS max_OID FROM ' . $this->BO->getTableName();
     $this->BO->setLastQuery($sqlQuery);
     try {
         $result = $this->BO->query($sqlQuery);
         $row = $result[0];
         if (isset($row['max_OID'])) {
             self::$logger->debug('<<getMAX [' . $row['max_OID'] . ']');
             return $row['max_OID'];
         } else {
             throw new AlphaException('Failed to get the MAX ID for the class [' . get_class($this->BO) . '] from the table [' . $this->BO->getTableName() . '], query is [' . $this->BO->getLastQuery() . ']');
         }
     } catch (\Exception $e) {
         throw new AlphaException($e->getMessage());
         self::$logger->debug('<<getMAX [0]');
         return 0;
     }
 }