Changeset 16643
- Timestamp:
- 03/26/09 22:41:00 (4 years ago)
- Files:
-
- doc/branches/1.2/tutorial/my-first-project.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
doc/branches/1.2/tutorial/my-first-project.txt
r15396 r16643 298 298 * @param sfRequest $request A request object 299 299 */ 300 public function executeIndex( $request)300 public function executeIndex(sfWebRequest $request) 301 301 { 302 302 } … … 341 341 342 342 [php] 343 public function executeShow( $request)343 public function executeShow(sfWebRequest $request) 344 344 { 345 345 $this->blog_post = BlogPostPeer::retrieveByPk($request->getParameter('id')); … … 400 400 401 401 [php] 402 <?php echo link_to('Add a comment', 'comment/ edit?post_id='.$blog_post->getId()) ?>402 <?php echo link_to('Add a comment', 'comment/new?post_id='.$blog_post->getId()) ?> 403 403 404 404 The `link_to()` helper creates a hyperlink pointing to the … … 426 426 >**Note**: For more details on the form framework, you are advised to read the 427 427 [Forms Book](http://www.symfony-project.org/book/forms/1_2/en/). 428 429 Then, the post id has to be automatically set from the request parameter passed in the URL. This 430 can be done by replacing the `executeNew()` method of the `comment` module by the following one. 431 432 [php] 433 class commentActions extends sfActions 434 { 435 public function executeNew(sfWebRequest $request) 436 { 437 $this->form = new BlogCommentForm(); 438 $this->form->setDefault('blog_post_id', $request->getParameter('post_id')); 439 } 440 441 // ... 442 } 428 443 429 444 After you have made this change, you will now be able to add a comment directly to a