1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| <?php
class Model_DbTable_Album extends Zend_Db_Table_Abstract {
/**
* The default table name
*/
protected $_name = 'album';
public function obtenirAlbum($id) {
$id = (int)$id;
$row = $this->fetchRow('id= '.$id);
if(!$row){
throw new Exception("Count not found row $id");
}
return $row->toArray();
}
public function ajouterAlbum($artiste, $titre) {
$data = array('artiste'=>$artiste, 'titre'=>$titre);
$this->insert($data);
}
public function modifierAlbum($id, $artiste, $titre) {
$data = array('artiste'=>$artiste, 'titre'=>$titre);
$this->update($data,'id = '.(int)$id);
}
public function supprimerAlbum($id) {
$this->delete('id= '.(int)$id);
}
} |
Partager