Commit df4850fa authored by zYne's avatar zYne

--no commit message

--no commit message
parent 133b7e24
......@@ -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
......
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):
<code>
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)
</code>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment