Example #1
0
 function getColumnType($column)
 {
     if (isset($this->event_obj) && method_exists($this->event_obj, 'getColumnType')) {
         $type = $this->event_obj->getColumnType($column);
         if ($type) {
             return $type;
         }
     }
     return parent::getColumnType($column);
 }
Example #2
0
 /**
  * get the maximum index value in the table.
  *
  * @param AppModel $Model
  * @param string $scope
  * @param string $right
  * @return int
  * @access private
  */
 function __getMax($Model, $scope, $right, $recursive = -1, $created = false)
 {
     $db =& ConnectionManager::getDataSource($Model->useDbConfig);
     if ($created) {
         if (is_string($scope)) {
             $scope .= " AND {$Model->alias}.{$Model->primaryKey} <> ";
             $scope .= $db->value($Model->id, $Model->getColumnType($Model->primaryKey));
         } else {
             $scope['NOT'][$Model->alias . '.' . $Model->primaryKey] = $Model->id;
         }
     }
     $name = $Model->alias . '.' . $right;
     list($edge) = array_values($Model->find('first', array('conditions' => $scope, 'fields' => $db->calculate($Model, 'max', array($name, $right)), 'recursive' => $recursive)));
     return empty($edge[$right]) ? 0 : $edge[$right];
 }