Show
Ignore:
Timestamp:
10/02/08 03:07:08 (18 months ago)
Author:
jwage
Message:

[1.1] fixes #255 Added ability to validate a group of fields

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/1.1/lib/Doctrine/Record/Abstract.php

    r5030 r5033  
    113113        } 
    114114    } 
     115 
     116    /** 
     117     * Specify an array of fields that are unique and will be validated as such 
     118     * 
     119     * @return void 
     120     */ 
     121    public function unique() 
     122    { 
     123        $args = func_get_args(); 
     124 
     125        if (count($args) == 1) { 
     126            $fields = (array) $args[0]; 
     127        } else if (count($args) > 1) { 
     128            $fields = $args; 
     129        } else { 
     130            throw new Doctrine_Record_Exception('You must specify the fields to make a unique constraint on.'); 
     131        } 
     132 
     133        return $this->_table->unique($fields); 
     134    } 
     135 
    115136    public function setAttribute($attr, $value) 
    116137    {