javascript - POST 500 (Internal Server Error) when I use the JEditable plugin -


i'm trying use jeditable plugin in symfony2 application. pys entity a films , tv shows entity; i've got usuario , critica entities. want manage user's critics plugin. i've analyzed more , more examples, can not work. value (in case title of critic) update in template not in db; when refresh browser old value appears.

the error:

enter image description here

this js:

$('.edit').editable(function(value, settings) {          var data = {};         data[this.id] = value;         console.log(path);         console.log(data);         $.post(path, data);             return(value);     }, {         indicator : 'saving...',         tooltip   : 'click edit...'     }); 

this route:

critica_ajax:     locales: { es: "/gestion-critica/{pysstr}/", en: "/manage-critic/{pysstr}/" }     defaults: { _controller: usuariobundle:default:gestionarcritica } 

this controller:

public function gestionarcriticaaction($pysstr) {     $em = $this->getdoctrine()->getmanager();     $pys = $em->getrepository('pysbundle:pys')->findpys($pysstr);     $usuario = $this->get('security.context')->gettoken()->getuser();     $critica = $em->getrepository('usuariobundle:usuario')->findcritica($usuario, $pys);      if(!$critica)      {         $critica = new critica($usuario, $pys);     }      $crititulo = $this->request->get('value');     $critica->setcrititulo($crititulo);      $critica->setcricontenido($cricontenido);     $critica->setcrifecha(new \datetime("now"));      $em->persist($critica);       $em->flush();      return new response($crititulo); } 

the twig template:

<h2 class="edit">{{ critica.crititulo }}</h2> <script>     var path = "{{ path('critica_ajax', { 'pysstr': pelicula.pysstr}) }}"; </script> 

edit (the symfony's return)

notice: undefined property: filmboot\usuariobundle\controller\defaultcontroller::$request in c:\programming\xampp\htdocs\filmboot\src\filmboot\usuariobundle\controller\defaultcontroller.php line 236  line 236: $crititulo = $this->request->get('value');  @ errorhandler ->handle ('8', 'undefined property: filmboot\usuariobundle\controller\defaultcontroller::$request', 'c:\programming\xampp\htdocs\filmboot\src\filmboot\usuariobundle\controller\defaultcontroller.php', '236', array('pysstr' => 'machete', 'em' => object(entitymanager), 'pys' => object(pys), 'usuario' => object(usuario), 'critica' => object(critica)))      in c:\programming\xampp\htdocs\filmboot\src\filmboot\usuariobundle\controller\defaultcontroller.php @ line 236   +     @ defaultcontroller ->gestionarcriticaaction ('machete')     @ call_user_func_array (array(object(defaultcontroller), 'gestionarcriticaaction'), array('machete'))      in c:\programming\xampp\htdocs\filmboot\app\bootstrap.php.cache @ line 1003   +     @ httpkernel ->handleraw (object(request), '1')      in c:\programming\xampp\htdocs\filmboot\app\bootstrap.php.cache @ line 977   +     @ httpkernel ->handle (object(request), '1', true)      in c:\programming\xampp\htdocs\filmboot\app\bootstrap.php.cache @ line 1103   +     @ containerawarehttpkernel ->handle (object(request), '1', true)      in c:\programming\xampp\htdocs\filmboot\app\bootstrap.php.cache @ line 413   +     @ kernel ->handle (object(request))      in c:\programming\xampp\htdocs\filmboot\web\app_dev.php @ line 26   + 

you need request :

$request = $this->getrequest(); 

instead of

$request = $this->request; 

the request returned using method not class property


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -