<?php

/**
 * Article
 * 
 * This class has been auto-generated by the Doctrine ORM Framework
 * 
 * @package    sf
 * @subpackage model
 * @author     Atma
 * @version    SVN: $Id: Builder.php 7490 2010-03-29 19:53:27Z jwage $
 */
class Article extends BaseArticle
{
    public function save(Doctrine_Connection $conn = null)
    {
        if ($this->getAlias() == "") {
            $newAlias = Page::translit($this->getTranslation()->ru->title);
            $counter = 1;
            while (Doctrine::getTable("Article")->findOneByAlias($newAlias)) {
                $newAlias .= $counter;
                $counter++;
            }
            $this->setAlias($newAlias);
        }
        parent::save($conn);
    }
}
