Skip to content

Conversation

@mirza99
Copy link

@mirza99 mirza99 commented Mar 18, 2016

When using Propel, and having a column with the type "array", in the function getOptions the parameter type is CollectionType.
When having a CollectionType, it is considering that we have always a relation but in the case using an array we havent. So a exception is thrown saying that we are calling getType on a boolean variable.

The fix is :


if (preg_match("#CollectionType$#i", $type)) {
            $relation = $this->getRelation($columnName, $class);

++            if ($relation) {
                return array(
                    'allow_add'     => true,
                    'allow_delete'  => true,
                    'by_reference'  => false,
                    'entry_type' => 'entity',
                    'entry_options' => array(
                        'class' => \RelationMap::MANY_TO_ONE === $relation->getType() ? $relation->getForeignTable()->getClassname() : $relation->getLocalTable()->getClassname()
                    )
                );
++            }

++            return array(
++                   'entry_type' => 'text',
++               );
        }


sescandell added a commit that referenced this pull request Mar 19, 2016
fixing dbType array when using propel
@sescandell sescandell merged commit ea1781e into symfony2admingenerator:master Mar 19, 2016
@sescandell
Copy link
Member

Many thanks @mirza99 👍

@sescandell sescandell added this to the v2.1 milestone Mar 19, 2016
@mirza99
Copy link
Author

mirza99 commented Mar 21, 2016

You're welcome ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants