Changeset 6196
- Timestamp:
- 11/28/07 08:49:12 (2 years ago)
- Files:
-
- trunk/lib/form/sfForm.class.php (modified) (2 diffs)
- trunk/lib/form/sfFormField.class.php (modified) (7 diffs)
- trunk/lib/validator/sfValidator.class.php (modified) (5 diffs)
- trunk/lib/validator/sfValidatorAll.class.php (modified) (1 diff)
- trunk/lib/validator/sfValidatorAny.class.php (modified) (1 diff)
- trunk/lib/validator/sfValidatorDecorator.class.php (modified) (1 diff)
- trunk/lib/validator/sfValidatorErrorSchema.class.php (modified) (2 diffs)
- trunk/lib/validator/sfValidatorFromDescription.class.php (modified) (3 diffs)
- trunk/lib/validator/sfValidatorSchema.class.php (modified) (4 diffs)
- trunk/lib/validator/sfValidatorSchemaCompare.class.php (modified) (1 diff)
- trunk/lib/validator/sfValidatorSchemaFilter.class.php (modified) (1 diff)
- trunk/lib/validator/sfValidatorSchemaForEach.class.php (modified) (1 diff)
- trunk/lib/widget/sfWidget.class.php (modified) (3 diffs)
- trunk/lib/widget/sfWidgetFormDateTime.class.php (modified) (1 diff)
- trunk/lib/widget/sfWidgetFormSchema.class.php (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/form/sfForm.class.php
r6158 r6196 500 500 if (!$widget = $this->widgetSchema[$name]) 501 501 { 502 throw new sfException(sprintf('Widget "%s" does not exist.', $name));502 throw new InvalidArgumentException(sprintf('Widget "%s" does not exist.', $name)); 503 503 } 504 504 … … 517 517 * @param string (ignored) 518 518 * 519 * @throws <b> sfException</b>519 * @throws <b>LogicException</b> 520 520 */ 521 521 public function offsetSet($offset, $value) 522 522 { 523 throw new sfException('Cannot update form fields.');523 throw new LogicException('Cannot update form fields.'); 524 524 } 525 525 trunk/lib/form/sfFormField.class.php
r6114 r6196 82 82 if ($this->widget instanceof sfWidgetFormSchema) 83 83 { 84 throw new sfException('Unable to format a row on a sfWidgetFormSchema.');84 throw new LogicException('Unable to format a row on a sfWidgetFormSchema.'); 85 85 } 86 86 … … 103 103 if ($this->widget instanceof sfWidgetFormSchema) 104 104 { 105 throw new sfException('Unable to format an error list on a sfWidgetFormSchema.');105 throw new LogicException('Unable to format an error list on a sfWidgetFormSchema.'); 106 106 } 107 107 … … 118 118 if ($this->widget instanceof sfWidgetFormSchema) 119 119 { 120 throw new sfException('Unable to render a label on a sfWidgetFormSchema.');120 throw new LogicException('Unable to render a label on a sfWidgetFormSchema.'); 121 121 } 122 122 … … 133 133 if ($this->widget instanceof sfWidgetFormSchema) 134 134 { 135 throw new sfException('Unable to render a label name on a sfWidgetFormSchema.');135 throw new LogicException('Unable to render a label name on a sfWidgetFormSchema.'); 136 136 } 137 137 … … 224 224 if (!$this->widget instanceof sfWidgetFormSchema) 225 225 { 226 throw new sfException(sprintf('Cannot get a form field on a non widget schema (%s given).', get_class($this->widget)));226 throw new LogicException(sprintf('Cannot get a form field on a non widget schema (%s given).', get_class($this->widget))); 227 227 } 228 228 229 229 if (is_null($widget = $this->widget[$name])) 230 230 { 231 throw new sfException(sprintf('Widget "%s" does not exist.', $name));231 throw new InvalidArgumentException(sprintf('Widget "%s" does not exist.', $name)); 232 232 } 233 233 … … 244 244 * @param string (ignored) 245 245 * 246 * @throws <b> sfException</b>246 * @throws <b>LogicException</b> 247 247 */ 248 248 public function offsetSet($offset, $value) 249 249 { 250 throw new sfException('Cannot update form fields (read-only).');250 throw new LogicException('Cannot update form fields (read-only).'); 251 251 } 252 252 … … 256 256 * @param string (ignored) 257 257 * 258 * @throws sfException258 * @throws LogicException 259 259 */ 260 260 public function offsetUnset($offset) 261 261 { 262 throw new sfException('Cannot remove form fields (read-only).');262 throw new LogicException('Cannot remove form fields (read-only).'); 263 263 } 264 264 } trunk/lib/validator/sfValidator.class.php
r6002 r6196 61 61 if ($diff = array_diff(array_keys($options), array_merge(array_keys($this->options), $this->requiredOptions))) 62 62 { 63 throw new sfException(sprintf('%s does not support the following options: \'%s\'.', get_class($this), implode('\', \'', $diff)));63 throw new InvalidArgumentException(sprintf('%s does not support the following options: \'%s\'.', get_class($this), implode('\', \'', $diff))); 64 64 } 65 65 … … 67 67 if ($diff = array_diff(array_keys($messages), array_keys($this->messages))) 68 68 { 69 throw new sfException(sprintf('%s does not support the following error codes: \'%s\'.', get_class($this), implode('\', \'', $diff)));69 throw new InvalidArgumentException(sprintf('%s does not support the following error codes: \'%s\'.', get_class($this), implode('\', \'', $diff))); 70 70 } 71 71 … … 73 73 if ($diff = array_diff($this->requiredOptions, array_merge(array_keys($this->options), array_keys($options)))) 74 74 { 75 throw new sfException(sprintf('%s requires the following options: \'%s\'.', get_class($this), implode('\', \'', $diff)));75 throw new RuntimeException(sprintf('%s requires the following options: \'%s\'.', get_class($this), implode('\', \'', $diff))); 76 76 } 77 77 … … 132 132 if (!in_array($name, array_keys($this->messages))) 133 133 { 134 throw new sfException(sprintf('%s does not support the following error code: \'%s\'.', get_class($this), $name));134 throw new InvalidArgumentException(sprintf('%s does not support the following error code: \'%s\'.', get_class($this), $name)); 135 135 } 136 136 … … 191 191 if (!in_array($name, array_merge(array_keys($this->options), $this->requiredOptions))) 192 192 { 193 throw new sfException(sprintf('%s does not support the following option: \'%s\'.', get_class($this), $name));193 throw new InvalidArgumentException(sprintf('%s does not support the following option: \'%s\'.', get_class($this), $name)); 194 194 } 195 195 trunk/lib/validator/sfValidatorAll.class.php
r5816 r6196 52 52 else if (!is_null($validators)) 53 53 { 54 throw new sfException('sfValidatorAll constructor takes a sfValidator object, or a sfValidator array.');54 throw new InvalidArgumentException('sfValidatorAll constructor takes a sfValidator object, or a sfValidator array.'); 55 55 } 56 56 trunk/lib/validator/sfValidatorAny.class.php
r5816 r6196 52 52 else if (!is_null($validators)) 53 53 { 54 throw new sfException('sfValidatorAny constructor takes a sfValidator object, or a sfValidator array.');54 throw new InvalidArgumentException('sfValidatorAny constructor takes a sfValidator object, or a sfValidator array.'); 55 55 } 56 56 trunk/lib/validator/sfValidatorDecorator.class.php
r5816 r6196 35 35 if (!$this->validator instanceof sfValidator) 36 36 { 37 throw new sfException('The getValidator() method must return a sfValidator instance.');37 throw new RuntimeException('The getValidator() method must return a sfValidator instance.'); 38 38 } 39 39 trunk/lib/validator/sfValidatorErrorSchema.class.php
r5581 r6196 228 228 * @param string (ignored) 229 229 * 230 * @throws <b> sfException</b>230 * @throws <b>LogicException</b> 231 231 */ 232 232 public function offsetSet($offset, $value) 233 233 { 234 throw new sfException('Unable update an error.');234 throw new LogicException('Unable update an error.'); 235 235 } 236 236 … … 239 239 * 240 240 * @param string (ignored) 241 *242 * @throws sfException243 241 */ 244 242 public function offsetUnset($offset) trunk/lib/validator/sfValidatorFromDescription.class.php
r5753 r6196 89 89 if (!preg_match('/\s*([a-z0-9_\-]+)/', substr($string, $i), $match)) 90 90 { 91 throw new sfException('Parsing problem.');91 throw new DomainException('Parsing problem.'); 92 92 } 93 93 … … 138 138 else 139 139 { 140 throw new sfException(sprintf('Unable to parse string (%s).', $string));140 throw new DomainException(sprintf('Unable to parse string (%s).', $string)); 141 141 } 142 142 } … … 238 238 if ($token instanceof sfValidatorFDTokenLeftBracket || $token instanceof sfValidatorFDTokenRightBracket) 239 239 { 240 throw new sfException(sprintf('Uneven parenthesis in string (%s).', $this->string));240 throw new DomainException(sprintf('Uneven parenthesis in string (%s).', $this->string)); 241 241 } 242 242 trunk/lib/validator/sfValidatorSchema.class.php
r5949 r6196 49 49 else if (!is_null($fields)) 50 50 { 51 throw new sfException('sfValidatorSchema constructor takes an array of sfValidator objects.');51 throw new InvalidArgumentException('sfValidatorSchema constructor takes an array of sfValidator objects.'); 52 52 } 53 53 … … 100 100 if (!is_array($values)) 101 101 { 102 throw new sfException('You must pass an array parameter to the clean() method');102 throw new InvalidArgumentException('You must pass an array parameter to the clean() method'); 103 103 } 104 104 … … 227 227 if (!$validator instanceof sfValidator) 228 228 { 229 throw new sfException('A field must be an instance of sfValidator.');229 throw new InvalidArgumentException('A field must be an instance of sfValidator.'); 230 230 } 231 231 … … 258 258 public function asString($indent = 0) 259 259 { 260 throw new sfException('Unable to convert a sfValidatorSchema to string.');260 throw new Exception('Unable to convert a sfValidatorSchema to string.'); 261 261 } 262 262 } trunk/lib/validator/sfValidatorSchemaCompare.class.php
r5882 r6196 67 67 if (!is_array($values)) 68 68 { 69 throw new sfException('You must pass an array parameter to the clean() method');69 throw new InvalidArgumentException('You must pass an array parameter to the clean() method'); 70 70 } 71 71 trunk/lib/validator/sfValidatorSchemaFilter.class.php
r5882 r6196 49 49 if (!is_array($values)) 50 50 { 51 throw new sfException('You must pass an array parameter to the clean() method');51 throw new InvalidArgumentException('You must pass an array parameter to the clean() method'); 52 52 } 53 53 trunk/lib/validator/sfValidatorSchemaForEach.class.php
r5753 r6196 47 47 public function asString($indent = 0) 48 48 { 49 throw new sfException('Unable to convert a sfValidatorSchemaForEach to string.');49 throw new Exception('Unable to convert a sfValidatorSchemaForEach to string.'); 50 50 } 51 51 } trunk/lib/widget/sfWidget.class.php
r6153 r6196 41 41 if ($diff = array_diff(array_keys($options), array_merge(array_keys($this->options), $this->requiredOptions))) 42 42 { 43 throw new sfException(sprintf('%s does not support the following options: \'%s\'.', get_class($this), implode('\', \'', $diff)));43 throw new InvalidArgumentException(sprintf('%s does not support the following options: \'%s\'.', get_class($this), implode('\', \'', $diff))); 44 44 } 45 45 … … 47 47 if ($diff = array_diff($this->requiredOptions, array_merge(array_keys($this->options), array_keys($options)))) 48 48 { 49 throw new sfException(sprintf('%s requires the following options: \'%s\'.', get_class($this), implode('\', \'', $diff)));49 throw new RuntimeException(sprintf('%s requires the following options: \'%s\'.', get_class($this), implode('\', \'', $diff))); 50 50 } 51 51 … … 128 128 if (!in_array($name, array_merge(array_keys($this->options), $this->requiredOptions))) 129 129 { 130 throw new sfException(sprintf('%s does not support the following option: \'%s\'.', get_class($this), $name));130 throw new InvalidArgumentException(sprintf('%s does not support the following option: \'%s\'.', get_class($this), $name)); 131 131 } 132 132 trunk/lib/widget/sfWidgetFormDateTime.class.php
r5950 r6196 75 75 if (!is_array($options)) 76 76 { 77 throw new sfException(sprintf('You must pass an array for the %s option.', $type));77 throw new InvalidArgumentException(sprintf('You must pass an array for the %s option.', $type)); 78 78 } 79 79 trunk/lib/widget/sfWidgetFormSchema.class.php
r5995 r6196 67 67 else if (!is_null($fields)) 68 68 { 69 throw new sfException('sfWidgetFormSchema constructor takes an array of sfWidget objects.');69 throw new InvalidArgumentException('sfWidgetFormSchema constructor takes an array of sfWidget objects.'); 70 70 } 71 71 … … 124 124 * @return sfWidgetFormSchemaFormatter sfWidgetFormSchemaFormatter instance 125 125 * 126 * @throws sfException126 * @throws InvalidArgumentException 127 127 */ 128 128 public function getFormFormatter() … … 141 141 } 142 142 143 throw new sfException(sprintf('The form formatter "%s" does not exist.', $name));143 throw new InvalidArgumentException(sprintf('The form formatter "%s" does not exist.', $name)); 144 144 } 145 145 … … 280 280 if (is_null($widget = $this[$name])) 281 281 { 282 throw new sfException(sprintf('The field named "%s" does not exist.', $name));282 throw new InvalidArgumentException(sprintf('The field named "%s" does not exist.', $name)); 283 283 } 284 284 … … 309 309 if (!is_array($values) && !$values instanceof ArrayAccess) 310 310 { 311 throw new sfException('You must pass an array of values to render a widget schema');311 throw new InvalidArgumentException('You must pass an array of values to render a widget schema'); 312 312 } 313 313 … … 460 460 if (!$widget instanceof sfWidget) 461 461 { 462 throw new sfException('A field must be an instance of sfWidget.');462 throw new InvalidArgumentException('A field must be an instance of sfWidget.'); 463 463 } 464 464 … … 519 519 if (array_diff($positions, array_keys($this->fields)) || array_diff(array_keys($this->fields), $positions)) 520 520 { 521 throw new sfException('Positions must contains all field names.');521 throw new InvalidArgumentException('Positions must contains all field names.'); 522 522 } 523 523 … … 543 543 if (false === $fieldPosition = array_search($field, $this->positions)) 544 544 { 545 throw new sfException(sprintf('Field "%s" does not exist.', $field));545 throw new InvalidArgumentException(sprintf('Field "%s" does not exist.', $field)); 546 546 } 547 547 unset($this->positions[$fieldPosition]); … … 552 552 if (false === $pivotPosition = array_search($pivot, $this->positions)) 553 553 { 554 throw new sfException(sprintf('Field "%s" does not exist.', $pivot));554 throw new InvalidArgumentException(sprintf('Field "%s" does not exist.', $pivot)); 555 555 } 556 556 } … … 567 567 if (is_null($pivot)) 568 568 { 569 throw new sfException(sprintf('Unable to move field "%s" without a relative field.', $field));569 throw new LogicException(sprintf('Unable to move field "%s" without a relative field.', $field)); 570 570 } 571 571 $this->positions = array_merge( … … 578 578 if (is_null($pivot)) 579 579 { 580 throw new sfException(sprintf('Unable to move field "%s" without a relative field.', $field));580 throw new LogicException(sprintf('Unable to move field "%s" without a relative field.', $field)); 581 581 } 582 582 $this->positions = array_merge( … … 587 587 break; 588 588 default: 589 throw new sfException(sprintf('Unknown move operation for field "%s".', $field));589 throw new LogicException(sprintf('Unknown move operation for field "%s".', $field)); 590 590 } 591 591 }

