Skip to content

Instantly share code, notes, and snippets.

@havvg
Created August 13, 2012 14:35
Show Gist options
  • Save havvg/3341266 to your computer and use it in GitHub Desktop.
Save havvg/3341266 to your computer and use it in GitHub Desktop.
Propel 1.6: Sluggable with I18n
<?xml version="1.0" encoding="UTF-8"?>
<database name="default" defaultIdMethod="native" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xsd.propelorm.org/1.6/database.xsd">
<table name="country">
<column name="id" type="integer" autoIncrement="true" primaryKey="true" />
<column name="iso_code" type="char" size="2" required="true" />
<column name="name" type="varchar" size="255" required="true" primaryString="true" />
<behavior name="i18n">
<parameter name="i18n_columns" value="name, url" />
<parameter name="default_locale" value="de_DE" />
</behavior>
<unique>
<unique-column name="iso_code" />
</unique>
</table>
<table name="country_i18n">
<column name="id" type="integer" autoIncrement="false" required="true" primaryKey="true" />
<column name="locale" type="varchar" size="5" required="true" primaryKey="true" />
<behavior name="sluggable">
<parameter name="slug_column" value="url" />
<parameter name="replace_pattern" value="/[^\\pL\\d]+/u" />
</behavior>
<foreign-key foreignTable="country" onDelete="CASCADE" onUpdate="CASCADE">
<reference local="id" foreign="id" />
</foreign-key>
</table>
</database>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment