Saturday, 15 August 2015

symfony2 - overriding ChangePasswordFOSUser1Controller prints code on login page -



symfony2 - overriding ChangePasswordFOSUser1Controller prints code on login page -

i'm curently developing app on symfony 2.5.0 using fosuserbundle, sonataadminbundle , sonatauserbundle. i've extended fosuserbundle appkernel.php has new sonata\userbundle\sonatauserbundle('fosuserbundle') , generated own application\sonata\userbundle using easy extends.

in application\sonatauserbundle, i've overriden changepasswordfosuser1controller so:

use symfony\component\dependencyinjection\containeraware; utilize symfony\component\httpfoundation\redirectresponse; utilize symfony\component\security\core\exception\accessdeniedexception; utilize symfony\component\httpfoundation\request; utilize fos\userbundle\model\userinterface; utilize sonata\userbundle\controller\changepasswordfosuser1controller basecontroller; class changepasswordfosuser1controller extends basecontroller { public function changepasswordaction() { $user = $this->container->get('security.context')->gettoken()->getuser(); if (!is_object($user) || !$user instanceof userinterface) { throw new accessdeniedexception('this user not have access section.'); } $form = $this->container->get('fos_user.change_password.form'); $formhandler = $this->container->get('fos_user.change_password.form.handler'); $process = $formhandler->process($user); if ($process) { $this->setflash('fos_user_success', 'change_password.flash.success'); if ($user->getfirstconnection()) $user->setfirstconnection(false); homecoming new redirectresponse($this->getredirectionurl($user)); } homecoming $this->container->get('templating')->renderresponse('sonatauserbundle:changepassword:changepassword.html.'.$this->container->getparameter('fos_user.template.engine'), array('form' => $form->createview())); } /** * {@inheritdoc} */ protected function getredirectionurl(userinterface $user) { homecoming $this->container->get('router')->generate('front_home'); } /** * @param string $action * @param string $value */ protected function setflash($action, $value) { $this->container->get('session')->getflashbag()->set($action, $value); } }

the problem is: whenever go login page see controller's code printed twice in "header section", right before login form.

i've tried clearing cache , voila ! cache cleared same code gets printed twice in shell. (yeah, work shell)

i "bug" on , on 1 time again when clearing cache on login page disappears after 2 page refresh.

have tried overriding controller or got similar error ? (would shame no 1 had)

thx help !

<?php

missing on changepasswordfosuser1controller.php code defined interpretable , printed plain text on every html page.

symfony2 controller override fosuserbundle sonata-user-bundle

No comments:

Post a Comment