.

DBFieldTextEmail Class Reference
[TextFields]

A field to hold an email. More...

Inheritance diagram for DBFieldTextEmail:
DBFieldText DBField IDBField IPolicyHolder

List of all members.

Public Member Functions

  __construct ($name, $default_value=null, $policy=self::NOT_NULL)
  validate ($value)
  Returns true, if the value passed fits the fields restrictions.

Detailed Description

A field to hold an email.

Field in DB should be defined as VARCHAR(255)

The theoretical maximum length of an email is 320 characters. 255 characters seem sufficient, though

Since:
0.5.1
Author:
Gerd Riesselmann

Definition at line 14 of file dbfield.text.email.cls.php.


Constructor & Destructor Documentation

DBFieldTextEmail::__construct ( name,
default_value = null,
policy = self::NOT_NULL  
)

Definition at line 15 of file dbfield.text.email.cls.php.

00015                                                                                           {
00016                 parent::__construct($name, 255, $default_value, $policy);
00017         }

Member Function Documentation

DBFieldTextEmail::validate ( value  ) 

Returns true, if the value passed fits the fields restrictions.

Parameters:
string  $value
Returns:
Status

Reimplemented from DBFieldText.

Definition at line 25 of file dbfield.text.email.cls.php.

00025                                          {
00026                 $ret = parent::validate($value);
00027                 if ($ret->is_ok() && Cast::string($value) !== '') {
00028                         if (!Validation::is_email($value)) {
00029                                 $ret->append(tr(
00030                                         '%field must be a valid email address', 
00031                                         'textfields', 
00032                                         array(
00033                                                 '%field' => tr($this->get_field_name()),
00034                                         )
00035                                 ));
00036                         }
00037                 }
00038                 return $ret;
00039         }       

The documentation for this class was generated from the following file: