ValidationinDoctrineisawaytoenforceyourbusinessrulesinthemodelpartoftheMVCarchitecture.Youcanthinkofthisvalidationasagatewaythatneedstobepassedrightbeforedatagetsintothepersistentdatastore.Thedefinitionofthesebusinessrulestakesplaceattherecordlevel,thatmeansinyouractiverecordmodelclasses(classesderivedfromDoctrine_Record).Thefirstthingyouneedtodotobeabletousethiskindofvalidationistoenableitglobally.ThisisdonethroughtheDoctrine_Manager(seethecodebelow).<br/><br/>Onceyouenabledvalidation,you'll get a bunch of validations automatically:<br /><br />- Data type validations: All values assigned to columns are checked for the right type. That meansif you specified a column of your record as type 'integer',Doctrinewillvalidatethatanyvaluesassignedtothatcolumnareofthistype.ThiskindoftypevalidationtriestobeassmartaspossiblesincePHPisalooselytypedlanguage.Forexample2aswellas"7"arebothvalidintegerswhilst"3f"isnot.Typevalidationsoccuroneverycolumn(sinceeverycolumndefinitionneedsatype).<br/><br/>-Lengthvalidation:Asthenameimplies,allvaluesassignedtocolumnsarevalidatedtomakesurethatthevaluedoesnotexceedthemaximumlength.