Beispiel #1
0
 public function delete($id)
 {
     //delete car's color associations
     $sql = "DELETE FROM automobile_car_colors WHERE car_id = ?";
     $vals = array((int) $id);
     $this->db->Execute($sql, $vals);
     parent::delete($id);
 }
Beispiel #2
0
 public function save($post, $auto_whitelist = true)
 {
     if ($this->isNewRecord($post)) {
         //Add new records at the end of the display order
         $segment_id = $this->segment ? $post[$this->segment] : null;
         $post[$this->order] = $this->maxDisplayOrder($segment_id) + 1;
     } else {
         if (empty($post[$this->order])) {
             //Remove the display order field from the fields list,
             // so existing value doesn't get null'ed by recordFromPost().
             $this->fields = array_diff($this->fields, array($this->order));
         }
     }
     return parent::save($post, $auto_whitelist);
 }