Cannot read index "type" from object of type "stdClass" because it doesn’t implement ArrayAccess

I am getting this error on this

    if ($this->container->getParameter('sso.so') === true)
    {
        $builder->add('familyMembers', CollectionType::class, array(
            'type' => new FamilyMember(),
            'allow_add' => TRUE,
            'allow_delete' => TRUE,
            'by_reference' => FALSE,
        ));

        $builder->get('familyMembers')->setData(array());
    }

this is the form Type

class FamilyMember extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options) {
        $builder
            ->add('type', ChoiceType::class, array(
                'label'     => ' ',
                'required'  => FALSE,
                'choices'   => array(
                    'SP'    => 'account.address.option.type.SP',
                    'DP'    => 'account.address.option.type.DP',
                ),
                'expanded'  => TRUE,
                'multiple'  => FALSE,
                'placeholder' => FALSE,
            ))

what I am trying to do is allow the form to be created if they meet that condition.

this worked but i updated to symfony2.8 and I also went from guzzle3 to guzzle 6 (doubt is this one)

Source: Symfony Questions

Was this helpful?

1 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *