2
votes

Here is the error message:

Warning (2): preg_match() [http://php.net/function.preg-match]: Delimiter must not be alphanumeric or backslash [CORE/cake/libs/model/model.php, line 2611]

This is happening when I call the following code from my controller:

$this->Account->save($this->data)

The model looks like this:

class Account extends AppModel 
{       
    var $validate = array(        
        'first_name' => array(
            'rule' => array('minLength', 1),
            'required' => true   
        ),
        'last_name' => array(
            'rule' => array('minLength', 1),
            'required' => true   
        ),
        'password' => array(
            'rule' => array('minLength', 8),
            'required' => true    
        ),        
        'email' => array(
            'emailRule1' => array(
                'rule' => 'email',
                'required' => true,
                'message' => 'You must specify a valid email address' 
            ),
            'emailRule2' => array(
                'rule' => 'unique',
                'message' => 'That email address is already in our system'     
            )
        )   
    );
}

I found a similar problem explained here

He solved it by changing required' => true to required' => array(true) I tried that for every occurange in my model but it did not fix the problem.

1

1 Answers

7
votes

The problem was I named the rule unique it should be isUnique instead.

I would have figured this out much faster with a better error message.