i started using symfony , i'm trying make simple prime number checker. controller doesn't seem work though, because though see form, after input number nothing happens ( text should appear saying if number prime or not )
<?php namespace appbundle\controller; use appbundle\entity\calculator; use sensio\bundle\frameworkextrabundle\configuration\route; use symfony\bundle\frameworkbundle\controller\controller; use symfony\component\httpfoundation\request; class todocontroller extends controller { /** * @route("/prime") */ public function listaction() { return $this->render('todo/index.html.twig'); } public function doitaction(request $request) { $data = $form->getdata(); return calculator::checknumber($data); } }
your code snippet missing i'm not sure if removed on purpose or it's empty.
please form examples documentation http://symfony.com/doc/current/forms.html
main part missing is
if ($form->handlerequest($request)->isvalid()) { $data = $form->getdata(); // something, render template etc }
Comments
Post a Comment