/** * Accepts postback from Example/viewModelFormBinding/ * Accepts postback from /view-model-annotated-binding-example/ * * @annotation DependenciesLocations(People) * @annotation DependencyInjection(PersonService, PersonViewModel) * * @return View */ public function viewModelFormBindingPostAction() { $this->createExampleDisplayTemplate("Annotated ViewModel Binding Example", "_viewModelAnnotatedBinding"); $this->view->content = "Hello World from the postback of <b>ExampleController viewModelFormBindingPostAction</b> action"; $this->view->addJavascript("public/js/example.js"); $_POST['genders'] = PeopleService::genders(); $_POST['languages'] = PeopleService::languages(); $_POST['province'] = PeopleService::provinces(); return $this->viewModel("People/Person", (object) $_POST); }
/** * Get a single Person object * * @return Person */ public static function get() { $person = new Person(); $person->firstName = "Romayne"; $person->lastName = "Eastmond"; $person->emailAddress = "*****@*****.**"; $person->description = "Hello World"; $person->provinceId = 1; $person->province = PeopleService::provinces(); $person->languages = PeopleService::languages(); $person->sex = "male"; $person->genders = PeopleService::genders(); $person->language = array(1); return $person; }