Blog: Propel 1.6 is Released
Propel 1.6.0 stable is there. It’s full of new features, robust, and still fast as hell. It’s the best Propel ever. If you’ve been waiting for happiness in the ORM world, if you want web development to be fun, and if you prefer to let the computer do all the heavy duty stuff for you, you’ve got to try this new release.
Propel 1.6.0 is backwards compatible with Propel 1.4 and 1.5. It means there is no upgrade costs, just benefits. As a consequence, the 1.5 branch is no longer maintained. Switch to 1.6 to get the latest bug fixes, in addition to the new features!
And boy, those new features will ease your life a lot. The extensive list is too long to be copied in this blog post, and the Propel online guide provides extensive documentation about all of theses new features already. So here is a glimpse of what’s new in the 1.6 release:
- Migrations: No more
insert-sqlcalls that erase your whole database, no more manual
ALTER TABLEstatements. Propel migrations detect modifications in your XML schemas, and generate the SQL code to migrate the table structure, while preserving existing data. Propel also generates the SQL to rollback the migration in case of problem. Even better, Propel generates a PHP migration class, that you can put under version control, and where you can add data migration code. Migrations are dead easy to use, use vendor-specific SQL, and work even for existing projects.
- Versionable Behavior: Did you ever dream of persisting each state of a given object in a database, just like you can do with files using Subversion or Git? Using the new versionable behavior, you can keep an audit log of all the changes to an object, revert to a previous state, get the revision history, and even compare revisions with each other. And what’s unique about the Propel versionable behavior is that it knows how to version related objects, too!
- I18n Behavior: One model, several translations, seamlessly, that’s what this behavior provides. Multilingual applications can now adapt the content to the user locale without any boilerplate code. And Propel does it right: IDE integration is taken into account, and the retrieval of i18n objects is optimized to keep a low query count.
- XML/YAML/JSON/CSV Parsing and Dumping: Propel 1.6 allows you to serialize and unserialize your model objects to and from your favorite format in a single method call. This feature is fully extensible, so the import/export capabilities of your object model are only limited by your imagination. Also, since YAML becomes the default string representation of Propel objects, it’s just as if you had a complete Command-Line Interface to your object model persistence!
- Easier OR in queries: Forget
orWhere(), and the inability to use generated filters when a query uses an OR. Propel 1.6 introduces the
ModelCriteria::_or()method, and simplifies the writing of queries that used to be more complex in Propel 1.5.
- Multiple Buildtime Connections: Projects using more than one database connection used to face a few cumbersome steps during the build phase. Propel 1.6 supports a
buildtime-conf.xmlconfiguration file, using the same syntax as the
runtime-conf.xmlfile, to allow several database connections at buildtime. So a project mixing MySQL and Oracle persistences won’t have issues with the generated code anymore.
- Support For SQL Schemas: At last, Propel supports grouping tables into database schemas in PostgreSQL, MSSQL, and MySQL. Propel also supports foreign keys between tables assigned to two different schemas. For MySQL, where “SQL schema” is a synonym for “database”, this allows for cross-database queries.
- Virtual Foreign Keys: Propel models can now share relationships even though the underlying tables aren’t linked by a foreign key. This ability may be of great use when writing Propel code on top of a legacy database.
- Advanced Column Types: In addition to LOB columns, Propel now supports enums, arrays, and value objects as object model properties. The database-agnostic implementation allows these column types to work on all supported RDBMS. And since code generation gives Propel a power that no other ORM has, these new column types are also available as filters in the generated query classes.
- Table Subqueries (a.k.a “Inline Views”): The new
ModelCriteria::addSelectQuery()method makes it easy to use a first query as the source for the SELECT part of a second query. This allows to solve complex cases that a single query can’t solve, or to optimize slow queries with several joins.
- Better Pluralizer: Have you ever considered Propel as a lame English speaker? Due to its poor pluralizer, Propel used to be create bad getter method names in one-to-many relationships, especially when dealing with foreign objects named ‘Child’, ‘Category’, ‘Wife’, or ‘Sheep’. Starting with Propel 1.6, Propel adds a new pluralizer class named
StandardEnglishPluralizer, which should take care of most of the irregular plural forms of your domain class names.
- Active Record Reference Documentation: There wasn’t any one-stop place to read about the abilities of the generated Active Record objects in the Propel documentation. Since Propel 1.6, the new Active Record reference makes it easier to learn the usage of Propel models using code examples.
There are a thousand more code changes, smaller additions, backwards compatible tweaks and optimizations. All inspired by usage and real life projects. All designed to simplify your web development. All fully unit tested and already documented, as usual.
Used together with the Symfony framework, Propel feels even more powerful and easy to use. All the initial configuration and setup phases are taken care of by the framework, and the Symfony Command Line Tools is an improvement on Propel’s native buildtime script.
Propel 1.6 as a Community Project
Niklas, tuebernickel, thadin, lvanderree, Crafty_Shadow, ardell, ddalmais, rozwell, oschonrock, Richtermeister, Joss, fonsinchen, paul.hanssen, lathspell, poisson, couac, vmakinen, KRavEN, in no particular order, all contributed code to the 1.6 release. There are many more who tested beta releases, opened tickets on the Propel Trac, or proofread the documentation. And even more who blogged about the new features even though the release wasn’t stable yet.
All these people show how much Propel is a community project. Thanks to all of them for their work. Without their help, Propel 1.6 wouldn’t be there today.
I also want to thank all the brave Propel users who answered questions on the Propel mailing-list and on the #Propel IRC channel. Newcomers and beta testers found a welcoming community, and that’s half of what people ask of a good Open-Source project.
Download Propel 1.6
Again, Propel 1.6 is backwards compatible with Propel 1.4 and 1.5. All you need to do to upgrade an existing project is to update your Propel version, and rebuild your project. The Propel library is available in all the usual formats:
> svn checkout http://svn.propelorm.org/tags/1.6.0
> git clone git://github.com/Xosofox/propel.git
> sudo pear upgrade propel/propel_generator > sudo pear upgrade propel/propel_runtime
- http://files.propelorm.org/propel-1.6.0.tar.gz (Linux)
- http://files.propelorm.org/propel-1.6.0.zip (Windows)
Speak About It
Propel still leverages code generation to provide a fast, professional, user- and IDE-friendly ORM to PHP. The Propel project is very much alive, and you’re going to love building applications with the new 1.6 release.
But Propel 1.6 took more than a year to complete. During this time, there was not much to talk about, so Propel needs some publicity. Don’t hesitate to leave your feedback as comments, tickets, or emails to the Propel mailing-lists.
And if you use Propel 1.6 and like it, please share your experience with your friends.