Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Application_Model_DbTable_Projects extends Zend_Db_Table_Abstract
- {
- protected $_name = 'projects';
- public function getProject($id)
- {
- $id = (int)$id;
- $row = $this->fetchRow('id = ' . $id);
- if (!$row){
- throw new Exception("Could not find row $id");
- }
- return $row->toArray();
- }
- public function addProject($id, $name, $price, $description)
- {
- $data = array(
- 'id' => $id,
- 'name' => $name,
- 'price' => $price,
- 'description' => $description,
- );
- $this->insert($data);
- }
- public function updateProject($id, $name, $price, $description)
- {
- $data = array(
- 'name' => $name,
- 'price' => $price,
- 'description' => $description,
- );
- $this->update($data, 'id = '. (int)$id);
- }
- public function deleteProject($id)
- {
- $this->delete('id =' . (int)$id);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement