Closed
Description
/**
* {@inheritdoc}
*
* @throws \InvalidArgumentException
*/
public function getManager($name = null)
{
if (null === $name) {
$name = $this->defaultManager;
}
//line 181
if (!isset($this->managers[$name])) {
throw new \InvalidArgumentException(sprintf('Doctrine %s Manager named "%s" does not exist.', $this->name, $name));
}
return $this->getService($this->managers[$name]);
}
for any reason the name is a object, this happen when I´m trying to overwrite a form type.
example:
class AddressType extends AbstractType
{
/**
* @param FormBuilderInterface $builder
* @param array $options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('country', 'chained_select', array('mapped' => false, 'class' => 'cesarve77\\ChainedSelectBundle\\Entity\\Country'));
$builder->add('state', 'chained_select', array('mapped' => false,'class' => 'cesarve77\\ChainedSelectBundle\\Entity\\State'));
$builder->add('city', 'chained_select', array('mapped' => true, 'class' => 'cesarve77\\ChainedSelectBundle\\Entity\\City'));
$builder
->add('address');
}
custom type chained_select
class ChainedSelectType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->addEventSubscriber(new AddChainedSelectSubscriber());
}
in subscriber:
public function preSetData(FormEvent $event)
{
$form = $event->getForm();
$data=$event->getData();
// custom logic for change the $options
$form->add($form->getConfig()->getName(),'entity',$options);
}