From df4850fa4e18c2c0a02dd4a70beb0ef26dd14614 Mon Sep 17 00:00:00 2001 From: zYne Date: Fri, 28 Sep 2007 16:26:48 +0000 Subject: [PATCH] --- .../constraints-and-validators.txt | 19 +++++++++++++++++++ .../en/basic-schema-mapping/introduction.txt | 7 ++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/manual/new/docs/en/basic-schema-mapping/constraints-and-validators.txt b/manual/new/docs/en/basic-schema-mapping/constraints-and-validators.txt index df66e60a7..801e9d268 100644 --- a/manual/new/docs/en/basic-schema-mapping/constraints-and-validators.txt +++ b/manual/new/docs/en/basic-schema-mapping/constraints-and-validators.txt @@ -8,6 +8,25 @@ Doctrine allows you to define *portable* constraints on columns and tables. Cons Doctrine constraints act as database level constraints as well as application level validators. This means double security: the database doesn't allow wrong kind of values and neither does the application. +Here is a full list of available validators within Doctrine: + +|| validator(arguments) || constraints || description || +|| notnull || NOT NULL || Ensures the 'not null' constraint in both application and database level || +|| email || || Checks if value is valid email. || +|| notblank || NOT NULL || Checks if value is not blank. || +|| notnull || || Checks if value is not null. || +|| nospace || || Checks if value has no space chars. || +|| past || CHECK constraint || Checks if value is a date in the past. || +|| future || || Checks if value is a date in the future. || +|| minlength(length) || || Checks if value satisfies the minimum length. || +|| country || || Checks if value is a valid country code. || +|| ip || || Checks if value is valid IP (internet protocol) address. || +|| htmlcolor || || Checks if value is valid html color. || +|| range(min, max) || CHECK constraint || Checks if value is in range specified by arguments. || +|| unique || UNIQUE constraint || Checks if value is unique in its database table. || +|| regexp(expression) || || Checks if value matches a given regexp. || +|| creditcard || || Checks whether the string is a well formated credit card number || +|| digits(int, frac) || Precision and scale || Checks if given value has //int// number of integer digits and //frac// number of fractional digits || +++ Notnull diff --git a/manual/new/docs/en/basic-schema-mapping/introduction.txt b/manual/new/docs/en/basic-schema-mapping/introduction.txt index ddce00fe1..8293e73a5 100644 --- a/manual/new/docs/en/basic-schema-mapping/introduction.txt +++ b/manual/new/docs/en/basic-schema-mapping/introduction.txt @@ -1,8 +1,9 @@ This chapter and its subchapters tell you how to do basic schema mappings with Doctrine. After you've come in terms with the concepts of this chapter you'll know how to: 1. Define columns for your record classes -2. Define indexes -3. Define basic constraints and validators for columns +2. Define table options +3. Define indexes +4. Define basic constraints and validators for columns All column mappings within Doctrine are being done via the hasColumn() method of the Doctrine_Record. The hasColumn takes 4 arguments: @@ -54,7 +55,7 @@ $conn->export->exportClasses(array('Email')); The script would execute the following sql (we are using Mysql here as the database backend): -CREATE TABLE emails (id INT NOT NULL AUTO_INCREMENT, address VARCHAR(200) NOT NULL) +CREATE TABLE emails (id INT NOT NULL AUTO_INCREMENT, address VARCHAR(200) NOT NULL)