-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
trouble making the profile Edit work #57
Comments
id; } /** - Set nomClient * - @param string $nomClient - @return Client */ public function setNomClient($nomClient) { $this->nomClient = $nomClient; return $this; } /** - Get nomClient * - @return string */ public function getNomClient() { return $this->nomClient; } /** - Set prenomClient * - @param string $prenomClient - @return Client */ public function setPrenomClient($prenomClient) { $this->prenomClient = $prenomClient; return $this; } /** - Get prenomClient * - @return string */ public function getPrenomClient() { return $this->prenomClient; } /** - Set adresseLivraison * - @param string $adresseLivraison - @return Client */ public function setAdresseLivraison($adresseLivraison) { $this->adresseLivraison = $adresseLivraison; return $this; } /** - Get adresseLivraison * - @return string */ public function getAdresseLivraison() { return $this->adresseLivraison; } } |
my profileClientController |
container->get('security.context')->getToken()->getUser(); if (!is_object($user) || !$user instanceof UserInterface) { throw new AccessDeniedException('This user does not have access to this section.'); } ``` return $this->container->get('templating')->renderResponse('FOSUserBundle:Profile:show.html.'.$this->container->getParameter('fos_user.template.engine'), array('user' => $user)); } /** * Edit the user */ public function editAction(Request $request) { $user = $this->container->get('security.context')->getToken()->getUser(); if (!is_object($user) || !$user instanceof UserInterface) { throw new AccessDeniedException('This user does not have access to this section.'); } /** @var $dispatcher \Symfony\Component\EventDispatcher\EventDispatcherInterface */ $dispatcher = $this->container->get('event_dispatcher'); $event = new GetResponseUserEvent($user, $request); $dispatcher->dispatch(FOSUserEvents::PROFILE_EDIT_INITIALIZE, $event); if (null !== $event->getResponse()) { return $event->getResponse(); } /** @var $formFactory \FOS\UserBundle\Form\Factory\FactoryInterface */ $formFactory = $this->container->get('fos_user.profile.form.factory'); $form = $formFactory->createForm(); $form->setData($user); if ('POST' === $request->getMethod()) { $form->bind($request); if ($form->isValid()) { /** @var $userManager \FOS\UserBundle\Model\UserManagerInterface */ $userManager = $this->container->get('fos_user.user_manager'); $event = new FormEvent($form, $request); $dispatcher->dispatch(FOSUserEvents::PROFILE_EDIT_SUCCESS, $event); $userManager->updateUser($user); if (null === $response = $event->getResponse()) { $url = $this->container->get('router')->generate('fos_user_profile_show'); $response = new RedirectResponse($url); } $dispatcher->dispatch(FOSUserEvents::PROFILE_EDIT_COMPLETED, new FilterUserResponseEvent($user, $request, $response)); return $response; } } return $this->container->get('templating')->renderResponse( 'pfeScoringBundle:Profile:editclient.html.'.$this->container->getParameter('fos_user.template.engine'), array('form' => $form->createView()) ); } ``` } |
here my form |
class = $class; } public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('NomClient') ->add('PrenomClient') ->add('AdresseLivraison') ->add('Telephone') ; } public function getName() { return 'pfe_Client_profile'; } /** * Builds the embedded form representing the user. * * @param FormBuilderInterface $builder * @param array $options */ protected function buildUserForm(FormBuilderInterface $builder, array $options) { $builder ->add('username', null, array('label' => 'form.username', 'translation_domain' => 'FOSUserBundle')) ->add('email', 'email', array('label' => 'form.email', 'translation_domain' => 'FOSUserBundle')) ; } ``` } |
my routing.yml & sevices.yml |
pfe_scoring_homepage: Client_registration: Client_profile: |
parameters: pfe_scoring.example.class: pfe\ScoringBundle\Exampleservices: pfe_scoring.example:class: %pfe_scoring.example.class%arguments: [@service_id, "plain_value", %parameter%]pfe_Client.registration.form.type: pfe_Client.profile.form.type: |
could someone plz help me |
i get this Message The form's view data is expected to be of type scalar, array or an instance of \ArrayAccess, but is an instance of class pfe\ScoringBundle\Entity\Client. You can avoid this error by setting the "data_class" option to "pfe\ScoringBundle\Entity\Client" or by adding a view transformer that transforms an instance of class pfe\ScoringBundle\Entity\Client to scalar, array or an instance of \ArrayAccess. |
hi all,
I'm stuck and not solving the problem. I have correctly configured PUGXMultiUserBundle and I just need to make the profile Edit work of my class client work plz here it's my class
The text was updated successfully, but these errors were encountered: