Can't get custom error rendering to work in symfony 1.4

Posted by hongkildong on Stack Overflow See other posts from Stack Overflow or by hongkildong
Published on 2010-04-15T12:32:02Z Indexed on 2010/06/16 11:02 UTC
Read the original article Hit count: 307

Filed under:
|
|
|
|

I'm tring to customize error rendering in my form according to this example.

Here is my code:

if ($this['message']->hasError()) {
  $error_msg = '<ul>';
  foreach ($this['message']->getError() as $error) $error_msg .= "<li>$error</li>";
  $error_msg .= '</ul>';
}

return $error_msg;

but when $this['message'] has error this code returns '<ul></ul>' so it seems foreach ($this['message']->getError() as $error) causes no iterations

$this['message']->getError() returns sfValidatorError object - maybe something changed in symfony 1.4 and it isn't iterable anymore...

At first I thought that all magic in that example happened because of object being placed in $error by iteration implements __toString() but it seems no iterations happens at all...

© Stack Overflow or respective owner

Related posts about php

Related posts about oop