/** * Add a row in users_to_project * * @param int $user * @param int $project */ public function AddUserToProject($user, $project) { $table = new USVN_Db_Table_UsersToProjects(); $check = count($table->fetchRow(array('users_id = ?' => $user->users_id, 'projects_id = ?' => $project->projects_id))); if ($check == 0) { $row = $table->createRow(array('users_id' => $user->users_id, 'projects_id' => $project->projects_id)); $row->save(); } }
/** * Add a user to a project * * @param mixed user */ public function addUser($user) { $user_id = 0; if (is_object($user)) { $user_id = $user->id; } elseif (is_numeric($user)) { $user_id = intval($user); } if ($this->id && $user_id) { $table = new USVN_Db_Table_UsersToProjects(); $row = $table->createRow(array("users_id" => $user->id, "projects_id" => $this->id)); $row->save(); } }