<?php

/**
 * UserGroupUsers
 * 
 * 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 UserGroupUsers extends PluginUserGroupUsers
{
    public static function build(sfWebRequest $request, $user)
    {
        if ($request->hasParameter("user_group_id") && is_numeric($request->getParameter("user_group_id"))) {
            $user_group = Doctrine::getTable('UserGroupUsers')->findOneByUserIdAndUserGroupId($user->getId(), $request->getParameter("user_group_id"));
            if (!$user_group) {
                $user_group = new UserGroupUsers();
                $user_group->setUserId($user->getId());
                $user_group->setUserGroupId($request->getParameter("user_group_id"));
                $user_group->save();
            }
        }
    }
}
