_idPost = $id; return $this; } public function getIdPost() { return $this->_idPost; } public function getListSelect() { if (null === $this->_select) { parent::getListSelect(); $this->_select->where('`idPost` = ?', $this->getIdPost(), \Zend_Db::INT_TYPE); } return $this->_select; } public function getPostTitle() { if (!($id = $this->getIdPost())) { return false; } $select = $this->_db->select(); $select->from($this->_getTableName('Post'), ['title']); $select->where('`id` = ?', $id, \Zend_Db::INT_TYPE); $select->limit(1); return $this->_db->fetchOne($select); } public function initFromForm(array $data) { if ('insert' == $this->_action && !empty($this->_userInfo)) { $data = array_merge($this->_userInfo, $data); } return parent::initFromForm($data); } public function setUserInfo($data) { $this->_userInfo = $data; return $this; } public function setAction($action) { $this->_action = $action; return $this; } public function getAvailableStatuses() { $select = $this->_db->select(); $select->distinct(); $select->from($this->_getPair(), 'status'); if (null !== $this->_idPost) { $select->where('`idPost` = ?', $this->_idPost, \Qs_Db::INT_TYPE); } return $this->_db->fetchCol($select); } public function getObjectInfo() { $info = parent::getObjectInfo(); if ($info) { $date = date('M j, Y @ h:i A ', strtotime($info['date'])); $info['itemTitle'] = $info['author'] . ' (' . $date . ')'; } return $info; } }