public function save(Default_Model_Company $company) { $data = array('company_name' => $company->getCompanyName(), 'busines_type' => $company->getBusinesType(), 'tel' => $company->getTel(), 'email' => $company->getEmail(), 'address' => $company->getAddress(), 'website' => $company->getWebsite(), 'information' => $company->getInformation(), 'assign_cons' => $company->getAssignCons(), 'created_date' => $company->getCreatedDate(), 'updated_date' => $company->getUpdatedDate()); if (null == ($id = $company->getCompanyId())) { return $this->getDbTable()->insert($data); } else { unset($data['created_date']); $this->getDbTable()->update($data, array('company_id = ?' => $id)); return $id; } }
public function fetchAll($where = null, $orderby = null) { $resultSet = $this->getDbTable()->fetchAll($where, $orderby); $entries = array(); $entry = new Default_Model_Company(); foreach ($resultSet as $row) { $entry->getContactPersonId($row['contact_person_id']); $entry->getCompanyId($row['company_id']); $entry->setTitle($row['title']); $entry->setFullName($row['full_name']); $entry->setJobTitle($row['job_title']); $entry->setMobile($row['mobile']); $entry->setEmail($row['email']); $entries[] = $entry; } return $entries; }