/**
  * Install fixtures for ToDoList
  *
  * @return void
  */
 public function fixturesCommand()
 {
     $activeToDoList = new ToDoList();
     for ($i = 1; $i <= 3; $i++) {
         $item = new Item();
         $item->setLabel('Item #' . $i);
         $activeToDoList->addItem($item);
     }
     $this->toDoListRepository->add($activeToDoList);
     $this->outputLine('Successfully created fixtures');
 }
Example #2
0
 /**
  * Create a new list item
  *
  * @param string $label
  * @param ToDoList $list
  * @return void
  */
 public function addAction($label, ToDoList $list)
 {
     $item = new Item();
     $item->setLabel($label);
     $item->setList($list);
     $typoScriptView = new TypoScriptView();
     $typoScriptView->setControllerContext($this->controllerContext);
     $typoScriptView->setTypoScriptPath(self::TS_PATH_ITEM);
     $typoScriptView->assign('item', $item);
     $this->itemRepository->add($item);
     $this->view->assign('value', array('type' => 'success:add', 'entity' => get_class($item), 'view' => $typoScriptView->render()));
 }