public function formAction($method, $formData = array()) { if ($method === 'POST') { $people = $this->getPeopleFromFormData($formData); $this->repo->savePeople($people); $message = 'Data successfully submitted'; } else { $people = $this->repo->getAllPeople(); $message = false; } $this->template->render('basic-input-form', array('message' => $message, 'people' => $people)); }
private function setUpFixtures() { $people = [new Person('Leonard', 'Hofstader'), new Person('Sheldon', 'Cooper'), new Person('Raj', 'Koothrapali'), new Person('Howard', 'Wolowitz'), new Person('Penny', '')]; $repo = new PersonRepo(); $repo->savePeople($people); }