Blog: Propel Gets Better at Naming Things
Have you ever considered Propel as a lame English speaker? Due to its poor pluralizer, Propel used to be unable to create proper getter methods for one-to-many relationships 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. This new pluralizer is disabled by default for backwards compatibility reasons, but it’s very easy to turn it on in your build.properties
file:
propel.builder.pluralizer.class = builder.util.StandardEnglishPluralizer
Rebuild your model, and voila: ActiveRecord objects can now retrieve foreign objects using getChildren()
, getCategories()
, getWives()
, and… getSheep()
.
Thanks to Paul Hanssen for the patch.