10.04.2018 Views

Doctrine_manual-1-2-en

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 4: Configuration 31<br />

$table->setAttribute(<strong>Doctrine</strong>_Core::ATTR_VALIDATE,<br />

<strong>Doctrine</strong>_Core::VALIDATE_ALL);<br />

We hav<strong>en</strong>'t introduced the above used <strong>Doctrine</strong>_Core::getTable() method. You will<br />

learn more about the table objects used in <strong>Doctrine</strong> in the Table (page 164) section of the<br />

next chapter.<br />

Portability<br />

Each database managem<strong>en</strong>t system (DBMS) has it's own behaviors. For example, some<br />

databases capitalize field names in their output, some lowercase them, while others leave<br />

them alone. These quirks make it difficult to port your applications over to another database<br />

type. <strong>Doctrine</strong> strives to overcome these differ<strong>en</strong>ces so your applications can switch betwe<strong>en</strong><br />

DBMS's without any changes. For example switching from sqlite to mysql.<br />

The portability modes are bitwised, so they can be combined using | and removed using ^.<br />

See the examples section below on how to do this.<br />

You can read more about the bitwise operators on the PHP website 20 .<br />

Portability Mode Attributes<br />

Below is a list of all the available portability attributes and the description of what each one<br />

does:<br />

Name<br />

PORTABILITY_ALL<br />

PORTABILITY_DELETE_COUNT<br />

PORTABILITY_EMPTY_TO_NULL<br />

PORTABILITY_ERRORS<br />

Description<br />

Turn on all portability features. This is the<br />

default setting.<br />

Force reporting the number of rows deleted.<br />

Some DBMS's don't count the number of rows<br />

deleted wh<strong>en</strong> performingsimple DELETE FROM<br />

tabl<strong>en</strong>ame queries. This mode tricks such<br />

DBMS's into telling the count by adding WHERE<br />

1=1 to the <strong>en</strong>d of DELETE queries.<br />

Convert empty strings values to null in data in<br />

and output. Needed because Oracle considers<br />

empty strings to be null, while most other<br />

DBMS's know the differ<strong>en</strong>ce betwe<strong>en</strong> empty<br />

and null.<br />

Makes certain error messages in certain drivers<br />

compatible with those from other DBMS's<br />

PORTABILITY_FIX_ASSOC_FIELD_NAMES This removes any qualifiers from keys in<br />

associative fetches. Some RDBMS, like for<br />

example SQLite, will by default use the fully<br />

qualified name for a column in assoc fetches if<br />

it is qualified in a query.<br />

20. http://www.php.net/language.operators.bitwise<br />

----------------- Brought to you by

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!