Changeset 10834
- Timestamp:
- 08/13/08 13:43:15 (11 months ago)
- Files:
-
- branches/1.2/UPGRADE_TO_1_2 (modified) (5 diffs)
- branches/1.2/lib/action/sfAction.class.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.2/UPGRADE_TO_1_2
r10832 r10834 54 54 ---------- 55 55 56 The `sfValidatorSchemaCompare` constant values have been changed. No change to your code need to be done, but now, you can use nice shortcuts. The following two examples are equivalent: 56 The `sfValidatorSchemaCompare` constant values have been changed. No change to 57 your code need to be done, but now, you can use nice shortcuts. 58 The following two examples are equivalent: 57 59 58 60 [php] … … 66 68 ----- 67 69 68 Cookies are now extensively supported in the `sfBrowser` and `sfTestBrowser` classes. 70 Cookies are now extensively supported in the `sfBrowser` and `sfTestBrowser` 71 classes. 69 72 70 You can manage cookies between requests by using the `setCookie()`, `removeCookie()`, and `clearCookies()` methods of the `sfBrowser` class: 73 You can manage cookies between requests by using the `setCookie()`, 74 `removeCookie()`, and `clearCookies()` methods of the `sfBrowser` class: 71 75 72 76 [php] … … 81 85 // ... 82 86 83 You can also test cookies with the `hasCookie()` and `isCookie()` methods of the `sfTestBrowser` class: 87 You can also test cookies with the `hasCookie()` and `isCookie()` methods of 88 the `sfTestBrowser` class: 84 89 85 90 [php] … … 92 97 isCookie('foo', '/!z/')-> 93 98 94 The `hasCookie()` method takes a Boolean as its second argument to be able to test the fact that a cookie is not set. 99 The `hasCookie()` method takes a Boolean as its second argument to be able to 100 test the fact that a cookie is not set. 95 101 96 The second argument of the `isCookie()` method behaves as the second argument of the `checkElementResponse` method. It can be a string, a regular expression, or a negative regular expression. 102 The second argument of the `isCookie()` method behaves as the second argument 103 of the `checkElementResponse` method. It can be a string, a regular expression, 104 or a negative regular expression. 97 105 98 The browser class also automatically expires cookies as per the `expire` value of each cookie. 106 The browser class also automatically expires cookies as per the `expire` value 107 of each cookie. 99 108 100 109 YAML 101 110 ---- 102 111 103 The YAML parser now supports full merge key (see http://yaml.org/type/merge.html for more examples). 112 The YAML parser now supports full merge key (see http://yaml.org/type/merge.html 113 for more examples). 104 114 105 115 [php] … … 146 156 147 157 ) 158 159 Actions 160 ------- 161 162 By default, when you use the `redirectIf()` or `redirectUnless()` methods 163 in your actions, symfony automatically changes the response HTTP status 164 code to 302. 165 166 These two methods now have an additional optional argument to change this 167 default status code: 168 169 [php] 170 $this->redirectIf($condition, '@homepage', 301); 171 $this->redirectUnless($condition, '@homepage', 301); 172 173 The `redirect()` method already have this feature. branches/1.2/lib/action/sfAction.class.php
r9477 r10834 205 205 * @param bool $condition A condition that evaluates to true or false 206 206 * @param string $url Url 207 * @param string $statusCode Status code (default to 302) 207 208 * 208 209 * @throws sfStopException … … 210 211 * @see redirect 211 212 */ 212 public function redirectIf($condition, $url )213 public function redirectIf($condition, $url, $statusCode = 302) 213 214 { 214 215 if ($condition) 215 216 { 216 $this->redirect($url );217 $this->redirect($url, $statusCode); 217 218 } 218 219 } … … 225 226 * @param bool $condition A condition that evaluates to true or false 226 227 * @param string $url Url 228 * @param string $statusCode Status code (default to 302) 227 229 * 228 230 * @throws sfStopException … … 230 232 * @see redirect 231 233 */ 232 public function redirectUnless($condition, $url )234 public function redirectUnless($condition, $url, $statusCode = 302) 233 235 { 234 236 if (!$condition) 235 237 { 236 $this->redirect($url );238 $this->redirect($url, $statusCode); 237 239 } 238 240 }

