array('title', 'goal'), 'User' => array('name')); public function initFromForm(array $data) { $this->_arrayParseUrl2Tag($data); $this->_data = $data; if ($this->_data['otherSchool'] == 'y') { $this->_data['idSchool'] = $this->_getIdSchoolByName($this->_data['otherSchoolName']); } if (empty($this->_data['idSchool'])) { throw new Qs_Db_Exception("Can't delect file source"); } $this->_data['idUser'] = $this->_getSystemUserId(); if (empty($this->_data['idSchool'])) { throw new Qs_Db_Exception("Can't delect source contact"); } return $this; } protected function _getIdSchoolByName($name) { $schoolObj = new App_School_Obj(); return $schoolObj->getIdByName($name); } protected function _getSystemUserId() { $sql = "SELECT `id` FROM `{$this->_getTableName('User')}` WHERE `system` = 'y' LIMIT 1"; return $this->db->fetchOne($sql); } }