I want know if is possible (and how?) overwrite doctrine setters when we use i18n actAs...
I'm trying something like this:
class Category extends BaseCategory
{
/*
* Overwrite save method
*/
public function save(Doctrine_Connection $conn = null)
{
$conn = $conn ? $conn : $this->getTable()->getConnection();
开发者_Python百科$conn->beginTransaction();
try
{
$this->setSlug();
$ret = parent::save($conn);
$conn->commit();
return $ret;
}
catch (Exception $e)
{
$conn->rollBack();
throw $e;
}
}
public function setSlug()
{
$slug = $this->getName() . 'lala lala';
parent::_set('slug', $slug);
}
.....
But only save the $slug value in one lang (I have 2 languages).
Any Idea??
Thanks A Lot!
Thanks for replaying. I solved it like this:
$cultures = sfConfig::get('app_cultures');
// seteamos slug foreach($cultures as $culture) { parent::_set('slug', 'lala lala'); } ...
You can simply loop through the translations:
foreach($this->Translations as $lang => $t) {
$t->slug = $t->name.'lala';
}
精彩评论