I am having trouble making the profile Edit work.
Here is the code regarding that.... any help would be greatly appreciated.
<?php
namespace MHO\VmpBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller as BaseController;
use Symfony\Component\HttpFoundation\RedirectResponse;
class ProfileVmpPhysicianController extends BaseController
{
public function editAction()
{
$discriminator = $this->container->get('pugx_user_discriminator');
$discriminator->setClass('MHO\VmpBundle\Entity\VmpPhysician',$persist = true);
$form = $discriminator->getProfileForm();
$this->container->set('fos_user.profile.form', $form);
return $this->container->get('templating')->renderResponse('MHOVmpBundle:Profile:profile_vmp_physician.html.twig', array(
'form' => $form->createView(),
));
}
}
<?php
namespace MHO\VmpBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use FOS\UserBundle\Form\Type\ProfileFormType as BaseType;
class ProfileVmpPhysicianFormType extends BaseType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
parent::buildForm($builder, $options);
$builder
->add("username", "text", array( 'attr' => array(
'readonly' =>'readonly',
'class' => 'form-disabled' )))
->add("email", "email", array( 'attr' => array(
'readonly' =>'readonly',
'class' => 'form-disabled' )))
->add("firstname", "text", array( 'attr' => array(
'readonly' =>'readonly',
'class' => 'form-disabled' )))
->add("lastname", "text", array( 'attr' => array(
'readonly' =>'readonly',
'class' => 'form-disabled' )))
->add("middlename", "text", array(
'attr' => array('readonly' =>'readonly',
'class' => 'form-disabled' )))
->add('suffix', "text", array( 'attr' => array(
'readonly' =>'readonly',
'class' => 'form-disabled' )))
->add('homeAddress1', "text", array(
'label' => 'Address', ))
->add('homeAddress2', "text", array(
'label' => 'Address', 'required' => false, ))
->add('homeCity', "text", array(
'label' => 'City', ))
->add('homeState', "text", array(
'label' => 'State',))
->add('homeZipCode', 'text', array('pattern'=>'[0-9]{5}', 'label' => 'Zipcode', 'attr'=>array( 'maxlength' => '5')))
->add('officePhone', "text", array(
'label' => 'Office phone', ))
->add('fax')
->add('cellPhone', "text", array(
'label' => 'Mobile', ))
->add('npi', 'text', array('pattern'=>'[0-9]{10}', 'attr'=>array( 'maxlength' => '10')))
;
}
public function getName()
{
return 'fos_user_profile_form';
}
protected function buildUserForm(FormBuilderInterface $builder, array $options)
{
parent::buildUserForm($builder, $options);
}
}