Controller_Data_Array::generateNewId PHP Метод

generateNewId() публичный Метод

public generateNewId ( $model )
    public function generateNewId($model)
    {
        $ids = array_keys($model->_table[$this->short_name]);
        $type = $model->getElement($model->id_field)->type();
        if (in_array($type, array('int', 'integer'))) {
            return count($ids) === 0 ? 1 : max($ids) + 1;
        } elseif (in_array($type, array('str', 'string'))) {
            return uniqid();
        } else {
            throw $this->exception('Unknown id type')->addMoreInfo('type', $type)->addMoreInfo('support', array('int', 'str'));
        }
    }