You must first sign up to be able to contribute.


Revision 29549, 9.7 kB (checked in by francois, 8 years ago)

[sfPropel15Plugin] Added a mention in the installation instructions to rebuild the model

  • Property svn:executable set to *
1 sfPropel15Plugin
2 ================
4 Replaces symfony's core Propel plugin by the latest version of Propel, in branch 1.5.
6 Installation
7 ------------
9 Install the plugin via the subversion repository:
11     > svn co plugins/sfPropel15Plugin
13 from the project root directory or by using the command:
15     > ./symfony plugin:install sfPropel15Plugin
17 Right after the installation of the plugin, you should update plugin assets:
19     > ./symfony plugin:publish-assets
21 Disable the core Propel plugin and enable the `sfPropel15Plugin` instead:
23     [php]
24     class ProjectConfiguration extends sfProjectConfiguration
25     {
26       public function setup()
27       {
28         $this->enablePlugins('sfPropel15Plugin');
29       }
30     }
32 Change the path of the symfony behaviors in the `config/propel.ini` file of your project:
34     [ini]
35     propel.behavior.symfony.class                  = plugins.sfPropel15Plugin.lib.behavior.SfPropelBehaviorSymfony
36     propel.behavior.symfony_i18n.class             = plugins.sfPropel15Plugin.lib.behavior.SfPropelBehaviorI18n
37     propel.behavior.symfony_i18n_translation.class = plugins.sfPropel15Plugin.lib.behavior.SfPropelBehaviorI18nTranslation
38     propel.behavior.symfony_behaviors.class        = plugins.sfPropel15Plugin.lib.behavior.SfPropelBehaviorSymfonyBehaviors
39     propel.behavior.symfony_timestampable.class    = plugins.sfPropel15Plugin.lib.behavior.SfPropelBehaviorTimestampable
41 (Re)Build the model:
43     > ./symfony propel:build --all-classes
45 What's New In Propel 1.5
46 ------------------------
48 Propel 1.5 is a **backwards compatible** evolution of Propel 1.4 (the version bundled with symfony 1.3 and 1.4), which adds some very interesting features. Among these features, you will find the **new Propel Query API**, which is essentially a Criteria on steroids:
50     [php]
51     // find the 10 latest books published by authror 'Leo'
52     $books = BookQuery::create()
53       ->useAuthorQuery()
54         ->filterByFirstName('Leo')
55       ->endUse()
56       ->orderByPublishedAt('desc')
57       ->limit(10)
58       ->find($con);
60 Propel 1.5 also supports **many-to-many relationships**, **collections**, **on-demand hydration**, **new core behaviors** (see below), better Oracle support, and is now licensed under the MIT license.
62 Check out the [WHATS_NEW]( page in the Propel trac to see the full list of changes.
64 Core Propel Behaviors
65 ---------------------
67 Propel 1.5 bundles most common behaviors in a new, robust buildtime implementation. These core behaviors provide faster runtime execution and the ability to modify the data model:
69 - [timestampable](
70 - [sluggable](
71 - [soft_delete]([
72 - [nested_set](
73 - [sortable](
74 - [concrete_inheritance](
75 - [query_cache](
76 - [alternative_coding_standards](
77 - [auto_add_pk](
79 `sfPropel15Plugin` allows you to register core propel behaviors right from your `schema.yml`. For instance, to create a tree structure from a `Section` model:
81     [yaml]
82     propel:
83       section:
84         _attributes: { phpName: Section }
85         _propel_behaviors:
86           - nested_set
87         id: ~
88         title: { type: varchar(100), required: true primaryString: true }
90 **Tip**: Check the [`doc/schema.txt`]( file in this plugin source code for a complete reference of the YAML schema format.
92 You can also register a behavior for all your models right in the `propel.ini` configuration file. `sfPropel15Plugin` already enables the `symfony` and `symfony_i18n` behaviors to support symfony's behavior system and model localization features, but you can easily add your owns:
94     [ini]
95     propel.behavior.default = symfony,symfony_i18n,alternative_coding_standards,auto_add_pk
97 Admin Generator Extensions
98 --------------------------
100 The plugin comes bundled with a new admin generator theme named 'admin15'. This theme is backwards compatible with sfPropelPlugin's admin generator theme, and provides additional features based on the new Propel 1.5 query objects:
102 ### List view enhancements
104 - **Easy related objects hydration**: You don't need to write custom `doSelectJoinXXX()` methods to hydrate related objects. The `with` setting is much more poxwerful that the previous `peer_method` and `peer_count_method` settings, and much easier to use.
105 - **Custom query methods**: You can refine the query executed to display the list view by by setting the `query_methods` parameter. This allows to hydrate an additional column wit hno additional query, or to pre-filter the list to hide rows that the user shouldn't see.
106 - **All columns are sortable**: Virtual columns and foreign key columns are now sortable in the list view. You'll need to set the sort method to use for that, but it's a one-liner. No more lists with column headers that can't be clicked for sorting!
107 - **Easy links to filtered lists**: A link to a fitlered list view is very easy to write with the new theme. Just add GET parameter, the same way you used to do with the admin generator in symfony 1.2, and it works
108 - **Links to another admin module**: To make a foreign key column link to the edit view of the related object in another module, you no longer need to create a partial. Just define the `link_module` setting in the foreign key field configuration, and you're good to go:
109 - **Easy custom filters**: Adding custom filters becomes very easy once you can take advantage of the generated Propel query classes. This allows your, for instance, to setup a full-text search input in two minutes, replacing many text filters by a single one for better usability.
111 ### Filter and Edit forms enhancement
113 - **YAML widget customization**: The `generator.yml` format was extended to allow widget and validator customization directly in YAML, without the need to edit a form object. You can also safely omit a field from a `display` list in a form definition, without any risk to loose data.
114 - **Plain text field**: If you want to display some data in a form without allowing the user to edit it, use the `type: plain` attribute, just like in the old days of symfony 1.2. This is very useful for columns managed by the model, like `created_at` and `updated_at` columns.
116 The new options for the `admin15` generator theme are fully documented, and illustrated by real life examples, in the [`doc/admin_generator.txt`]( file in this plugin source code.
118 Form Subframework Modifications
119 -------------------------------
121 - **Updated `sfWidgetFormPropelChoice` widget**: The widget now uses the new Query API. You can customize the list of choices more easily by executing custom query methods, using the new `query_methods` option.
122 - **Updated Propel validators**: Both the `sfValidatorPropelChoice` and the `sfValidatorPropelUnique` were updated to use the new PropelQuery objects, and to accept a `query_methods` option similar to the one of `sfWidgetFormPropelChoice`.
123 - **Plain text widget and validator**: This new widget allows a field to be displayed in a form, without letting the use change it.
124 - **Easy Relation Embed**: Editing related objects together with the main objects (e.g., editing `Comments` in a `Post` form) is a piece of cake. The new `sfFormPropel::embedRelation()` method does all the work to fetch related objects, build the forms for each of them, and embed the related object forms into the main form. Embdeded relation forms allow to **edit**, **add**, and **delete** a related objects with no additional code.
126         [php]
127         class ArticleForm extends BaseArticleForm
128         {
129           public function configure()
130           {
131             $this->embedRelation('Book');
132           }
133         }
135 The Propel widgets, validators, and form classes are fully documented in the [`doc/form.txt`]( file in this plugin source code.
137 Routing Modifications
138 ---------------------
140 The plugin offer two new routing classes, `sfPropel15Route` and `sfPropel15RouteCollection`. These classes are used by default in the models build with the propel admin generator. They behave just like the previous `sfPropelRoute` class - except they don't use the `methods` option anymore. Instead, use the `query_methods` option to execute a list of arbitrary query methods when calling `getObject()` and `getObjects()`.
142     author:
143       class: sfPropel15RouteCollection
144       options:
145         model:                author
146         module:               author
147         prefix_path:          /author
148         column:               id
149         query_methods:       
150           object: [filterByIsPublished]
151           list:   [filterByIsPublished, orderByLastName]
152         with_wildcard_routes: true
154 `sfPropel15Route` also makes your code a little easier to read in the action. Instead of calling `getObject()`, you can actually call a getter using the class name of the object's route:
156     [php]
157     public function executeShow(sfWebRequest $request)
158     {
159       // using sfPropel15Route with 'Author' as model
160       $this->author = $this->getRoute()->getAuthor();
161     }
Note: See TracBrowser for help on using the browser.