Symfony2, how to access Entity values inside Form?
问题 I have a FormType in Symfony2. It is used to display the settings. The settings are stored as entities in a database. Using Doctrine2, I fetch the settings and create a form, like below: public function showSettingsAction() { if(false === $this->get('security.context')->isGranted('ROLE_ADMIN')) { throw new AccessDeniedException(); } $settings = new CommunitySettings(); $repository = $this->getDoctrine()->getRepository('TestTestingBundle:CommunitySettings'); $allSettings = $repository->findAll