예제 #1
0
 public function createAction()
 {
     $entity = new ProjectCommit();
     $entity->load_from_array($this->request->getParam("project_commit"));
     if (save_project_commit($entity)) {
         $this->flash->success("New ProjectCommit added!");
         $this->redirect_to(project_commit_list_path());
     } else {
         $this->render(array("entity" => $entity), "new");
     }
 }
예제 #2
0
/** 
Retrieves a list of ProjectCommit
@order = Optional, can be an array of keys or just a single key to order by the results
@limit = Optional
*/
function list_project_commit($order = null, $limit = null)
{
    global $__db_conn;
    $sql = "SELECT * FROM project_commit";
    if ($order != null) {
        $order_str = $order;
        if (is_array($order)) {
            $order_str = implode(",", $order);
        }
        $sql .= " order by {$order_str}";
    }
    if ($limit != null) {
        $sql .= " limit {$limit}";
    }
    $result = mysql_query($sql, $__db_conn);
    $results = array();
    while ($row = mysql_fetch_assoc($result)) {
        $tmp = new ProjectCommit();
        $tmp->load_from_array($row);
        $results[] = $tmp;
    }
    return $results;
}