<?php

/**
 * This class has been auto-generated by the Doctrine ORM Framework
 */
class ThdUser extends BaseThdUser
{
/*
   * Add new user and returns the new user object
   * If already exists returns user object
   */
  public static function addUser($userUid) {
    // Search tag
    $query = Doctrine_Query::create()
      ->from('ThdUser')
      ->where("uniqueid = '{$userUid}'");
    $obj = $query->execute()->getFirst();
    if ($obj) return $obj;

    // User does not exist so create it
    $obj = new ThdUser();
    $obj->setUniqueid($userUid);
    $obj->save();
    return $obj;
  }
}