示例#1
0
 protected function create()
 {
     $params = $this->getAllowedKeysForCreate();
     $note = new Note();
     $note->fromArray($params);
     $category = $_POST['category'];
     $category = CategoryQuery::create()->filterByUser($this->params['user'])->filterByName($category)->findOne();
     if ($category != null) {
         $note->setCategory($category);
     }
     $note->setUser($this->params['user']);
     $note->save();
     $this->addFlash("success", "Note added");
     redirectTo($note->getShowPath());
 }
示例#2
0
文件: User.php 项目: OneTimeCZ/Tasker
 /**
  * @param ChildNote $note The ChildNote object to add.
  */
 protected function doAddNote(ChildNote $note)
 {
     $this->collNotes[] = $note;
     $note->setUser($this);
 }