public function shareAction() { $request = $this->getRequest(); $post_id = $request->getParam('post_id'); $user_id = get_user_id(); $share_mapper = new Application_Model_ShareMapper(); $is_shared = $share_mapper->share($user_id, $post_id); if ($is_shared) { $notification_mapper = new Application_Model_NotificationMapper(); $notification_model = new Application_Model_Notification(); $post_mapper = new Application_Model_PostMapper(); $post = $post_mapper->find($post_id); $notification_model->_fields['user_id'] = $post['user_id']; $notification_model->_fields['is_seen'] = 0; $notification_model->_fields['content'] = get_username() . " Likes your post with id = {$post_id}"; $notification_mapper->save($notification_model); } $this->_redirect('/post/home'); }
public function shareAction() { // action body $request = $this->getRequest(); $id = $request->getParam('id'); if (isset($id)) { $shareMapper = new Application_Model_ShareMapper(); $rows = $shareMapper->find($id); // we need to extract the shared_wins and shared_wants if any // then we need to retrieve the wins_and_wants and specific wins and wants of // how do we do that? $this->view->rows = $rows[0]; } }