Notice: Undefined property: Acme\DemoBundle\Form\Type\Demanda\NewType::$router in C:\xampp\htdocs\gestion\src\Acme\DemoBundle\Form\Type\Demanda\NewType.php on line 29
Fatal error: Call to a member function generate() on a non-object in C:\xampp\htdocs\gestion\src\Acme\DemoBundle\Form\Type\Demanda\NewType.php on line 29
im using newType instead of editType but im getting the same if i puth the code in edit, here is my NewType.php
use Admingenerated\AcmeDemoBundle\Form\BaseDemandaType\NewType as BaseNewType;
use Symfony\Component\Routing\Matcher\UrlMatcher;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Route;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\DependencyInjection\Container;
/**
NewType
*/
class NewType extends BaseNewType {
protected function getFormOption($name, array $formOptions) {
if ($name === 'cliente') {
$formOptions = $this->getClientes($formOptions);
}
return $formOptions;
}
private function getClientes($formOptions) {
$ajax = '{
url: "' . $this->router->generate('queryClientes') . '", //here is the problem
dataType: "jsonp",
quietMillis: 100,
data: function (query, page) {
return {
query: query,
limit: 10,
page: page,
};
},
/more code ..../
}
my field in generator.yml
cliente:
label: Cliente
getter: cliente.nombre
filterOn: cliente
formType: afe_select2_entity
im stuck with this becouse my json response is workin good in i dont have how to try,
im also have replaced the $this->router->generate('queryClientes') whit the route and this show almost all the form, but not show the select2 field.
Hi, im following this https://github.com/avocode/FormExtensions/issues/22 to get select2 field in my form but im getting this error:
Notice: Undefined property: Acme\DemoBundle\Form\Type\Demanda\NewType::$router in C:\xampp\htdocs\gestion\src\Acme\DemoBundle\Form\Type\Demanda\NewType.php on line 29
Fatal error: Call to a member function generate() on a non-object in C:\xampp\htdocs\gestion\src\Acme\DemoBundle\Form\Type\Demanda\NewType.php on line 29
im using newType instead of editType but im getting the same if i puth the code in edit, here is my NewType.php
<?php //src/Acme/DemoBundle/Form/Type/Demanda/Newtype.php namespace Acme\DemoBundle\Form\Type\Demanda;
use Admingenerated\AcmeDemoBundle\Form\BaseDemandaType\NewType as BaseNewType; use Symfony\Component\Routing\Matcher\UrlMatcher; use Symfony\Component\Routing\RequestContext; use Symfony\Component\Routing\RouteCollection; use Symfony\Component\Routing\Route; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\DependencyInjection\Container;
/**
NewType */ class NewType extends BaseNewType {
protected function getFormOption($name, array $formOptions) { if ($name === 'cliente') { $formOptions = $this->getClientes($formOptions); }
}
private function getClientes($formOptions) { $ajax = '{ url: "' . $this->router->generate('queryClientes') . '", //here is the problem dataType: "jsonp", quietMillis: 100, data: function (query, page) { return { query: query, limit: 10, page: page, }; }, /more code ..../ }
my field in generator.yml cliente: label: Cliente getter: cliente.nombre filterOn: cliente formType: afe_select2_entity
im stuck with this becouse my json response is workin good in i dont have how to try,
im also have replaced the $this->router->generate('queryClientes') whit the route and this show almost all the form, but not show the select2 field.
ty for your time guys and good luck