I am working in symfony sonata admin. I am trying to extend ProfileFOSUser1Controller but unable to extend it. I have tried by clearing the cache also but didn't work? This is my controller code:
<?php
namespace Application\Sonata\UserBundle\Controller;
use Sonata\UserBundle\Controller\ProfileFOSUser1Controller as BaseController;
/**
* Overwrite methods from the ProfileFOSUser1Controller if you want to change the behavior
* for the current profile
*
*/
class ProfileUserController extends BaseController
{
/**
* @throws AccessDeniedException
*
* @return Response|RedirectResponse
*/
public function editAuthenticationAction()
{
echo "here"; die;
$user = $this->getUser();
if (!is_object($user) || !$user instanceof UserInterface) {
throw new AccessDeniedException('This user does not have access to this section.');
}
$form = $this->get('sonata.user.authentication.form');
$formHandler = $this->get('sonata.user.authentication.form_handler');
$process = $formHandler->process($user);
if ($process) {
$this->setFlash('sonata_user_success', 'profile.flash.updated');
return $this->redirect($this->generateUrl('sonata_user_profile_show'));
}
return $this->render('SonataUserBundle:Profile:edit_authentication.html.twig', [
'form' => $form->createView(),
]);
}
}
This issue has been resolved, I have changed the class name to the same name as base class have: changed "ProfileUserController" to "ProfileFOSUser1Controller". Now its working fine.