8000 Warning: Illegal offset type in isset or empty in/vendor/doctrine/common/lib/Doctrine/Common/Persistence/AbstractManagerRegistry.php line 180 · Issue #11188 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
Warning: Illegal offset type in isset or empty in/vendor/doctrine/common/lib/Doctrine/Common/Persistence/AbstractManagerRegistry.php line 180 #11188
Closed
@cesarve77

Description

@cesarve77
/**
     * {@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);
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0