You are currently browsing
the website for symfony 1
This plugin adds ObjectPath support to Propel (1.5+).
This syntax makes it very easy to do sorting and filtering on foreign fields.
ObjectPaths are dot-seperated relation-names that relate from one object to another and this behavior translates the objectPaths to table-aliasses.
So a very simple ObjectPath from City to Country is simply "Country" and from Country to City it would be "City": In other words the relation-name.
However ObjectPaths support dots to 'jump' from object to object. So for example from Review to Book to Author would be "Book.Author".
In Php-code this shows up as:
$query = new ReviewQuery(); $reviews = $query-> joinByObjectPath('Book.Author')-> orderBy('Book.Author.FirstName', Criteria::ASC)-> find();
to find all reviews, joined with their Books, joined with their Authors.
TODO: explain all changes and the behavior in more detail
To install this plugin you need to checkout this code in your symfony plugins folder under
After the checkout, modify your
propel.behavior.object_path.class = plugins.sfPropelObjectPathBehaviorPlugin.lib.ObjectPathBehavior
and add the default behavior, by modifying
propel.behavior.default = symfony,symfony_i18n,object_path
now rebuild your model and you are good to go!
$ php symfony propel:build-model
The objectPathsBehavior is used in the sfDataSourcePlugin.
Go to the repository: http://svn.symfony-project.com/plugins/sfPropelObjectPathBehaviorPlugin