Changeset 4186
- Timestamp:
- 06/09/07 09:58:45 (6 years ago)
- Files:
-
- doc/branches/1.0/book/01-Introducing-Symfony.txt (modified) (2 diffs)
- doc/branches/1.0/book/05-Configuring-Symfony.txt (modified) (1 diff)
- doc/branches/1.0/book/09-Links-and-the-Routing-System.txt (modified) (1 diff)
- doc/branches/1.0/book/10-Forms.txt (modified) (2 diffs)
- doc/branches/1.0/book/11-Ajax-Integration.txt (modified) (1 diff)
- doc/branches/1.0/book/12-Caching.txt (modified) (1 diff)
- doc/branches/1.0/book/14-Generators.txt (modified) (2 diffs)
- doc/branches/1.0/book/15-Unit-and-Functional-Testing.txt (modified) (2 diffs)
- doc/branches/1.0/book/17-Extending-Symfony.txt (modified) (1 diff)
- doc/branches/1.0/book/18-Performance.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
doc/branches/1.0/book/01-Introducing-Symfony.txt
r3404 r4186 242 242 street: Main Street 243 243 city: Nowheretown 244 zipcode: 12345244 zipcode: "12345" 245 245 246 246 In YAML, structure is shown through indentation, sequence items are denoted by a dash, and key/value pairs within a map are separated by a colon. YAML also has a shorthand syntax to describe the same structure with fewer lines, where arrays are explicitly shown with `[]` and hashes with `{}`. Therefore, the previous YAML data can be written in a shorter way, as follows: … … 248 248 house: 249 249 family: { name: Doe, parents: [John, Jane], children: [Paul, Mark, Simone] } 250 address: { number: 34, street: Main Street, city: Nowheretown, zipcode: 12345}250 address: { number: 34, street: Main Street, city: Nowheretown, zipcode: "12345" } 251 251 252 252 YAML is an acronym for Yet Another Markup Language and pronounced "yamel." The format has been around since 2001, and YAML parsers exist for a large variety of languages. doc/branches/1.0/book/05-Configuring-Symfony.txt
r3773 r4186 157 157 >YAML is just an interface to define settings to be used by PHP code, so the configuration defined in YAML files ends up being transformed into PHP. After browsing an application, check its cached configuration (in `cache/myapp/dev/config/`, for instance). You will see the PHP files corresponding to your YAML configuration. You will learn more about the configuration cache later in this chapter. 158 158 > 159 >The good news is that if you don't want to use YAML files, you can still do what the configuration files do by hand, in PHP or via another format (XML, IN T, and so on). Throughout this book, you will meet alternative ways to define configuration without YAML, and you will even learn to replace the symfony configuration handlers (in Chapter 19). If you use them wisely, these tricks will enable you to bypass configuration files or define your own configuration format.159 >The good news is that if you don't want to use YAML files, you can still do what the configuration files do by hand, in PHP or via another format (XML, INI, and so on). Throughout this book, you will meet alternative ways to define configuration without YAML, and you will even learn to replace the symfony configuration handlers (in Chapter 19). If you use them wisely, these tricks will enable you to bypass configuration files or define your own configuration format. 160 160 161 161 ### Help, a YAML File Killed My App! doc/branches/1.0/book/09-Links-and-the-Routing-System.txt
r3567 r4186 331 331 332 332 [php] 333 <?php echo link_to('my article', 'article/read ?title=Finance_in_France', array(333 <?php echo link_to('my article', 'article/read', array( 334 334 'query_string' => 'title=Finance_in_France' 335 335 )) ?> doc/branches/1.0/book/10-Forms.txt
r3673 r4186 209 209 => a text input tag together with a calendar widget 210 210 211 // The following helpers require the Date helper group 212 <?php use_helper('Date') ?> 211 // The following helpers require the DateForm helper group 212 <?php use_helper('DateForm') ?> 213 213 214 <?php echo select_day_tag('day', 1, 'include_custom=Choose a day') ?> 214 215 => <select name="day" id="day"> … … 783 784 nan_error: Please enter an integer 784 785 min: 0 785 min_error: The value must be more thanzero786 min_error: The value must be at least zero 786 787 max: 100 787 max_error: The value must be less than 100788 max_error: The value must be less than or equal to 100 788 789 789 790 #### E-Mail Validator doc/branches/1.0/book/11-Ajax-Integration.txt
r3607 r4186 755 755 order[]=1&order[]=3&order[]=2&_= 756 756 757 The full ordered list is passed as an array (with the format `order[$rank]=$id`, the `$ order` starting at 0, and the `$id` based on what comes after the underscore (`_`) in the list element `id` property). The `id` property of the sortable element (`order` in the example) is used to name the array of parameters.757 The full ordered list is passed as an array (with the format `order[$rank]=$id`, the `$rank` starting at 0, and the `$id` based on what comes after the underscore (`_`) in the list element `id` property). The `id` property of the sortable element (`order` in the example) is used to name the array of parameters. 758 758 759 759 The `sortable_element()` helper accepts the following parameters: doc/branches/1.0/book/12-Caching.txt
r3743 r4186 474 474 475 475 >**TIP** 476 >Instead of copying an existing one, you can create a new front controller with the `symfony` command line. For instance, to create a `staging` environment for the `myapp` application, called `myapp_staging.php` and where `SF_DEBUG` is `true`, just call `symfony init-controller myapp staging myapp_staging .phptrue`.476 >Instead of copying an existing one, you can create a new front controller with the `symfony` command line. For instance, to create a `staging` environment for the `myapp` application, called `myapp_staging.php` and where `SF_DEBUG` is `true`, just call `symfony init-controller myapp staging myapp_staging true`. 477 477 478 478 ### Monitoring Performance doc/branches/1.0/book/14-Generators.txt
r3412 r4186 907 907 ### Form Validation 908 908 909 If you take a look at the generated `_edit_form.php` template in your project `cache/` directory, you will see that the form fields use a special naming convention. In a generated `edit` view, the input names result from the concatenation of the modulename and the field name between angle brackets.910 911 For instance, if the `edit` view for the ` article` modulehas a `title` field, the template will look like Listing 14-35 and the field will be identified as `article[title]`.909 If you take a look at the generated `_edit_form.php` template in your project `cache/` directory, you will see that the form fields use a special naming convention. In a generated `edit` view, the input names result from the concatenation of the underscore-syntaxed model class name and the field name between angle brackets. 910 911 For instance, if the `edit` view for the `Article` class has a `title` field, the template will look like Listing 14-35 and the field will be identified as `article[title]`. 912 912 913 913 Listing 14-35 - Syntax of the Generated Input Names … … 1006 1006 <?php endif; ?> 1007 1007 1008 Notice that an edit partial always has access to the current object through a variable having the same name as the module, and that a `list` partial always has access to the current pager through the `$pager` variable.1008 Notice that an edit partial always has access to the current object through a variable named after the class, and that a `list` partial always has access to the current pager through the `$pager` variable. 1009 1009 1010 1010 >**SIDEBAR** doc/branches/1.0/book/15-Unit-and-Functional-Testing.txt
r3743 r4186 32 32 In the test-driven development (TDD) methodology, the tests are written before the code. Writing tests first helps you to focus on the tasks a function should accomplish before actually developing it. It's a good practice that other methodologies, like Extreme Programming (XP), recommend as well. Plus it takes into account the undeniable fact that if you don't write unit tests first, you never write them. 33 33 34 For instance, imagine that you must develop a text-stripping function. The function removes white spaces at the beginning and at the end of the string, replaces nonalphabetical characters by underscores, and transforms all uppercase characters to lowercase ones. In test-driven development, you would first think about all the possible cases and provide an example "nput and expected output for each, as shown in Table 15-1.34 For instance, imagine that you must develop a text-stripping function. The function removes white spaces at the beginning and at the end of the string, replaces nonalphabetical characters by underscores, and transforms all uppercase characters to lowercase ones. In test-driven development, you would first think about all the possible cases and provide an example input and expected output for each, as shown in Table 15-1. 35 35 36 36 Table 15-1 - A List of Test Cases for a Text-Stripping Function … … 610 610 $b->get('/foobar/edit/id/1')-> 611 611 isRequestParameter('id', 1)-> 612 isStatu tsCode()->612 isStatusCode()-> 613 613 isResponseHeader('content-type', 'text/html; charset=utf-8')-> 614 614 responseContains('edit'); doc/branches/1.0/book/17-Extending-Symfony.txt
r3412 r4186 392 392 class: myRequest 393 393 394 Bridges to Other Framework Components395 ------------------------------------- 394 Bridges to Other Framework's Components 395 --------------------------------------- 396 396 397 397 If you need capabilities provided by a third-party class, and if you don't want to copy this class in one of the symfony `lib/` dirs, you will probably install it outside of the usual places where symfony looks for files. In that case, using this class will imply a manual `require` in your code, unless you use the symfony bridge to take advantage of the autoloading. doc/branches/1.0/book/18-Performance.txt
r3412 r4186 148 148 doSelectJoinCategory() 149 149 150 // Retrieve Article objects and hydrate related Author and Category objects151 doSelectJoinA uthorAndCategory()150 // Retrieve Article objects and hydrate related objects except Author 151 doSelectJoinAllExceptAuthor() 152 152 153 153 // Synonym of