1

我有一张桌子,上面有文章。该表具有字段 id、title 和 text。

我在标题字段上使用 sluggable 行为导致唯一的 url

$sluggable0 = new Doctrine_Template_Sluggable(
        array('name'=>'url',
                'fields'=>array(0 => 'title'),
                'unique'=>true,
                'canUpdate'=>true)
);
$this->actAs($sluggable0);

现在我想用多种语言使用这篇文章。文本现在使用 I18n 行为国际化

   $this->actAs('I18n', array('fields'=>array('text')));

我的问题:如何国际化标题字段,以便在每种语言中使用唯一的 url?

谢谢!!

4

1 回答 1

2

这真的很简单,您需要将 sluggable 项作为子项添加到 I18n 行为中。

所以试试这个:

$i18n = new Doctrine_Template_I18n(array('fields' => array('text')));
$i18n->addChild($sluggable0);
$this->actAs($i18n);
于 2010-09-20T10:34:29.623 回答