Ticket #2932: date_format_exception.patch
| File date_format_exception.patch, 3.7 kB (added by manickam, 1 year ago) |
|---|
-
lib/exception/sfFieldException.class.php
old new 1 <?php 2 3 class sfFieldException extends sfException 4 { 5 protected $field; 6 7 function setField( $fld) 8 { 9 $this->field = $fld; 10 } 11 12 function getField() 13 { 14 return $this->field; 15 } 16 17 public function __construct( $message, $code = 0, $field = 'generic') 18 { 19 parent::__construct( $message, $code ); 20 $this->field = $field; 21 } 22 } 23 24 ?> 25 -
lib/plugins/sfPropelPlugin/data/generator/sfPropelAdmin/default/template/actions/actions.class.php
old new 49 49 50 50 public function executeSave() 51 51 { 52 return $this->forward('<?php echo $this->getModuleName() ?>', 'edit'); 52 try { 53 return $this->forward('<?php echo $this->getModuleName() ?>', 'edit'); 54 } 55 catch( sfStopException $e ) { 56 throw $e; 57 } 58 catch( sfFieldException $e) { 59 $this->getRequest()->setError( $e->getField(), $e->getMessage() ); 60 } 61 catch( Exception $e) { 62 $this->getRequest()->setError( "generic", $e->getMessage() ); 63 } 64 $this->getRequest()->setMethod( sfRequest::GET ); 65 $this->forward('<?php echo $this->getModuleName() ?>', 'edit'); 66 53 67 } 54 68 55 69 <?php $listActions = $this->getParameterValue('list.batch_actions') ?> … … 105 119 { 106 120 $this-><?php echo $this->getSingularName() ?> = $this->get<?php echo $this->getClassName() ?>OrCreate(); 107 121 108 if ($this->getRequest()-> isMethod('post'))122 if ($this->getRequest()->getMethod() == sfRequest::POST) 109 123 { 110 124 $this->update<?php echo $this->getClassName() ?>FromRequest(); 111 125 … … 166 180 167 181 public function handleErrorEdit() 168 182 { 169 $this->preExecute(); 170 $this-><?php echo $this->getSingularName() ?> = $this->get<?php echo $this->getClassName() ?>OrCreate(); 171 $this->update<?php echo $this->getClassName() ?>FromRequest(); 183 try { 184 $this->preExecute(); 185 $this-><?php echo $this->getSingularName() ?> = $this->get<?php echo $this->getClassName() ?>OrCreate(); 186 $this->update<?php echo $this->getClassName() ?>FromRequest(); 172 187 173 $this->labels = $this->getLabels(); 188 $this->labels = $this->getLabels(); 189 } catch( sfStopException $e ) { 190 throw $e; 191 } catch( sfFieldException $e) { 192 $this->getRequest()->setError( $e->getField(), $e->getMessage() ); 193 } catch ( Exception $e ) { 194 $this->getRequest()->setError( "generic", $e->getMessage() ); 195 } 174 196 175 197 return sfView::SUCCESS; 198 176 199 } 177 200 178 201 protected function save<?php echo $this->getClassName() ?>($<?php echo $this->getSingularName() ?>) … … 308 331 catch (sfException $e) 309 332 { 310 333 // not a date 334 $this->logMessage("{sfAction} <?php echo $column->getPhpName() ?> : ".$e->getMessage(), "info" ); 335 $ex = new sfFieldException( $e->getMessage(), 0, "<?php echo $this->getSingularName() ?>{<?php echo $name ?>}" ); 336 throw $ex; 311 337 } 312 338 } 313 339 else