示例#1
0
 public static function getInstance()
 {
     if (is_null(self::$_instance)) {
         self::$_instance = new self();
         self::$_instance->_table = 'blogPost';
     }
     return self::$_instance;
 }
 public function composeAction()
 {
     $this->isAllowed('compose');
     $request = $this->getRequest();
     $form = new Application_Form_BlogPost();
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($request->getPost())) {
             Application_Model_BlogRepository::getInstance()->post(new Application_Model_Entity_BlogPost(['userId' => $this->_session->getSessionId(), 'title' => $form->getValue('name'), 'content' => $form->getValue('content'), 'language' => $form->getValue('language'), 'tags' => $form->getValue('tags')]));
         }
     } else {
         $form->getElement('language')->setValue('en');
     }
     $this->view->form = $form;
 }