![]() |
|
sfPropel15Plugin - 1.1.5Replaces symfony's core Propel plugin by the latest version of Propel, in branch 1.5. |
|
![]() |
77
users
Sign-in
to change your status |
Bundles Propel 1.5 and replaces sfPropelPlugin in symfony 1.3 and 1.4. |
Bundles Propel 1.5 and replaces sfPropelPlugin in symfony 1.3 and 1.4.
| Name | Status | |
|---|---|---|
|
|
lead | moc.tcejorp-ynofmys <<ta>> ottoninaz.siocnarf |
Copyright (c) 2004-2008 Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
| Version | License | API | Released |
|---|---|---|---|
| 1.1.5stable | MIT license | 1.1.0stable | 01/02/2011 |
| 1.1.4stable | MIT license | 1.1.0stable | 08/08/2010 |
| 1.1.0stable | MIT license | 1.1.0stable | 31/07/2010 |
| 1.0.0stable | MIT license | 1.0.0stable | 25/05/2010 |
| 0.9.3beta | MIT license | 0.9.0beta | 19/05/2010 |
| 0.9.2beta | MIT license | 0.9.0beta | 06/05/2010 |
| 0.9.0beta | MIT license | 0.9.0beta | 13/04/2010 |
| 0.5.6alpha | MIT license | 0.5.0alpha | 30/12/2009 |
| 0.5.5alpha | MIT license | 0.5.0alpha | 28/12/2009 |
| 0.5.4alpha | MIT license | 0.5.0alpha | 17/12/2009 |
| 0.5.3alpha | MIT license | 0.5.0alpha | 17/12/2009 |
| Version | License | API | Released |
|---|---|---|---|
| 1.1.5stable | MIT license | 1.1.0stable | 01/02/2011 |
| 1.1.4stable | MIT license | 1.1.0stable | 08/08/2010 |
| 1.1.0stable | MIT license | 1.1.0stable | 31/07/2010 |
| 1.0.0stable | MIT license | 1.0.0stable | 25/05/2010 |
| 0.9.3beta | MIT license | 0.9.0beta | 19/05/2010 |
| 0.9.2beta | MIT license | 0.9.0beta | 06/05/2010 |
| 0.9.0beta | MIT license | 0.9.0beta | 13/04/2010 |
| 0.5.6alpha | MIT license | 0.5.0alpha | 30/12/2009 |
| 0.5.5alpha | MIT license | 0.5.0alpha | 28/12/2009 |
| 0.5.4alpha | MIT license | 0.5.0alpha | 17/12/2009 |
| 0.5.3alpha | MIT license | 0.5.0alpha | 17/12/2009 |
generator.yml syntax, the schema.yml syntax, and the custom form widgets and validatorsArray
Replaces symfony's core Propel plugin by the latest version of Propel, in branch 1.5.
Install the plugin via the subversion repository:
> svn co http://svn.symfony-project.com/plugins/sfPropel15Plugin/trunk plugins/sfPropel15Plugin
from the project root directory or by using the command:
> ./symfony plugin:install sfPropel15Plugin
Right after the installation of the plugin, you should update plugin assets:
> ./symfony plugin:publish-assets
Disable the core Propel plugin and enable the sfPropel15Plugin instead:
class ProjectConfiguration extends sfProjectConfiguration { public function setup() { $this->enablePlugins('sfPropel15Plugin'); } }
Change the path of the symfony behaviors in the config/propel.ini file of your project:
propel.behavior.symfony.class = plugins.sfPropel15Plugin.lib.behavior.SfPropelBehaviorSymfony propel.behavior.symfony_i18n.class = plugins.sfPropel15Plugin.lib.behavior.SfPropelBehaviorI18n propel.behavior.symfony_i18n_translation.class = plugins.sfPropel15Plugin.lib.behavior.SfPropelBehaviorI18nTranslation propel.behavior.symfony_behaviors.class = plugins.sfPropel15Plugin.lib.behavior.SfPropelBehaviorSymfonyBehaviors propel.behavior.symfony_timestampable.class = plugins.sfPropel15Plugin.lib.behavior.SfPropelBehaviorTimestampable
(Re)Build the model:
> ./symfony propel:build --all-classes
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:
// find the 10 latest books published by authror 'Leo' $books = BookQuery::create() ->useAuthorQuery() ->filterByFirstName('Leo') ->endUse() ->orderByPublishedAt('desc') ->limit(10) ->find($con);
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.
Check out the WHATS_NEW page in the Propel trac to see the full list of changes.
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:
sfPropel15Plugin allows you to register core propel behaviors right from your schema.yml. For instance, to create a tree structure from a Section model:
propel:
section:
_attributes: { phpName: Section }
_propel_behaviors:
- nested_set
id: ~
title: { type: varchar(100), required: true primaryString: true }
Tip: Check the doc/schema.txt file in this plugin source code for a complete reference of the YAML schema format.
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:
propel.behavior.default = symfony,symfony_i18n,alternative_coding_standards,auto_add_pk
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:
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.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.link_module setting in the foreign key field configuration, and you're good to go: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.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.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.
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. 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.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.
class ArticleForm extends BaseArticleForm { public function configure() { $this->embedRelation('Book'); } }
The Propel widgets, validators, and form classes are fully documented in the doc/form.txt file in this plugin source code.
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().
author:
class: sfPropel15RouteCollection
options:
model: author
module: author
prefix_path: /author
column: id
query_methods:
object: [filterByIsPublished]
list: [filterByIsPublished, orderByLastName]
with_wildcard_routes: true
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:
public function executeShow(sfWebRequest $request) { // using sfPropel15Route with 'Author' as model $this->author = $this->getRoute()->getAuthor(); }
