Esempio n. 1
0
 /**
  * @param string $text
  * @return TodoList
  */
 public function createList($text)
 {
     $todoList = new TodoList();
     $todoList->setName($text);
     $this->objectManager->persist($todoList);
     $this->objectManager->flush();
     return $todoList;
 }
Esempio n. 2
0
 /**
  * @param TodoList $list
  * @return array
  */
 private function formatList(TodoList $list)
 {
     return ['id' => $list->getId(), 'name' => $list->getName(), 'tasks' => $list->getTasks()->map(function (Task $task) {
         return $task->getId();
     })->toArray()];
 }