php if code- save okay else foreach user- getMessages as message this-

1
2
3
4
5
6
7
8
<?php
if ($code->save()) {
//okay
}
else foreach ($user->getMessages() as $message) $this->flash->error($message);