Which symfony version are you using? Because could be "EntityType::class" instead of "entity"
Att., Cassiano Tartari 2016-07-29 13:52 GMT-03:00 Stephane Alamichel <[email protected]> : > Dear all, > > I have an issue that i do not understand how to figure out. > > I would like to put a form view into a blockService to put on the > dashboard. > > I have a formType as this : > > class GoogleMapType extends AbstractType { > > public function buildForm(FormBuilderInterface $builder, array $options) { > ... > ->add('adoptant', 'entity', array( > 'class' => 'acmeBundle:Persons\Adoptant', > 'query_builder' => function (AdoptantRepository $ar) { > return $ar->queryFindAll(); > }, > 'multiple' => true, > 'required' => false, > )) > ... > > > My block Service is like this > > > class GoogleMapsBlockService extends BaseBlockService { > > public function __construct($type, $templating) { > $this->type = $type; > $this->templating = $templating; > } > > public function getName() { > return 'googleMaps'; > } > > public function getDefaultSettings() { > return array(); > } > > public function validateBlock(ErrorElement $errorElement, > BlockInterface $block) { > > } > > public function buildEditForm(FormMapper $formMapper, BlockInterface > $block) { > > } > > public function execute(BlockContextInterface $blockContext, Response > $response = null) { > $settings = array_merge($this->getDefaultSettings(), > $blockContext->getBlock()->getSettings()); > > $formFactory = Forms::createFormFactory(); > > $form = $formFactory->create(new GoogleMapType()); > > return > $this->renderResponse('AcmeBundle:Block:GoogleMaps.html.twig', array( > 'block' => $blockContext->getBlock(), > 'settings' => $settings, > 'form' => $form->createView(), > ), $response); > } > > } > > > > When I "plug" the blockservice into sonata admin configuration i have this > error > > "An exception has been thrown during the rendering of a template ("Could > not load type "entity"") in SonataAdminBundle:Core:dashboard.html.twig at > line 24." > > It's work correctly if there are not 'entity' type into the formType. > > Please do you know how to push formtype with entity type ? > > Regards > ps : thanks a lot for this project ! > > > > > -- > You received this message because you are subscribed to the Google Groups > "sonata-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/sonata-users. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "sonata-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sonata-users. For more options, visit https://groups.google.com/d/optout.
