{"id":101,"date":"2008-08-12T13:10:23","date_gmt":"2008-08-12T21:10:23","guid":{"rendered":"http:\/\/www.codebelay.com\/blog\/?p=101"},"modified":"2008-08-12T13:25:50","modified_gmt":"2008-08-12T21:25:50","slug":"symfony-11-validation-gotchas","status":"publish","type":"post","link":"https:\/\/www.codebelay.com\/blog\/2008\/08\/12\/symfony-11-validation-gotchas\/","title":{"rendered":"Symfony 1.1 Validation &#8212; Gotchas"},"content":{"rendered":"<p><strong>1. sfValidatorAnd requires a patch to work with Propel.<\/strong><\/p>\n<p>Get the patch <a href=\"http:\/\/trac.symfony-project.org\/attachment\/ticket\/4046\/ticket4046.php.patch?format=raw\">here<\/a>. <\/p>\n<p>Read <a href=\"http:\/\/trac.symfony-project.org\/ticket\/4046 \">the trac ticket<\/a> for more details.<\/p>\n<p><strong>2. A huge difference between 1.0 and 1.1 in form validation deals with error handling.<\/strong><\/p>\n<p>1.0 puts the error handling right in the action. In 1.1 you use code in a lib\/forms file that looks like this for validation \/ error handling and corresponds usually to the object being validated. In the example below the code is in lib\/forms\/AccountForm.class.php<\/p>\n<pre>\r\n$this->setValidators(array(\r\n    'username' => new sfValidatorString(array('max_length' => 30))\r\n));\r\n<\/pre>\n<p><strong>3. sfForm::setDefaults doesn&#8217;t work quite right with CSRF values.<\/strong><br \/>\nyou&#8217;ll need to patch up code based on<a href=\"http:\/\/groups.google.com\/group\/symfony-devs\/browse_thread\/thread\/9b1d68c9f1df6b00\"> this google groups post.<\/a><\/p>\n<p>The documentation right now for 1.1 isn&#8217;t updated. E.G. The chapter on forms for the 1.1 documentation as of 12 August 2008 will lead you down the wrong path.<\/p>\n<p>To keep up to date on what&#8217;s going on with symfony, I totally consider doing the following mandatory and not optional:<\/p>\n<ul>\n<li><strong>Join the google group, <a href=\"http:\/\/groups.google.com\/group\/symfony-users\">symfony-users<\/a><\/strong><\/li>\n<li><strong>Join the irc channel in irc.freenode.net #symfony any time you&#8217;ve got a question that needs asking<\/strong><\/li>\n<li><strong>Since the docs might be off, it&#8217;s best to just read the source.<\/strong><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>1. sfValidatorAnd requires a patch to work with Propel. Get the patch here. Read the trac ticket for more details. 2. A huge difference between 1.0 and 1.1 in form validation deals with error handling. 1.0 puts the error handling right in the action. In 1.1 you use code in a lib\/forms file that looks [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,56,33],"tags":[111,391,110,109],"class_list":["post-101","post","type-post","status-publish","format-standard","hentry","category-how-to","category-php","category-webapps","tag-gotchas","tag-php","tag-symfony","tag-symfony-11"],"_links":{"self":[{"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/posts\/101","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/comments?post=101"}],"version-history":[{"count":0,"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/posts\/101\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/media?parent=101"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/categories?post=101"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codebelay.com\/blog\/wp-json\/wp\/v2\/tags?post=101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}