Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid array key #494

Closed
zaerl opened this issue Oct 18, 2018 · 2 comments
Closed

Invalid array key #494

zaerl opened this issue Oct 18, 2018 · 2 comments

Comments

@zaerl
Copy link

zaerl commented Oct 18, 2018

On DoctrineMongoDBExtension::normalizeDriverOptions:319 we have typemap (as well as on all tests) but on ext-mongodb Client class constructor the key is typeMap. This generate various problems with array type hints on Doctrine\ODM\MongoDB\UnitOfWork:getOrCreateDocument for example which expect an array but get a MongoDB\Model\BSONArray (which is the default and is not an array).

A var_dump of generated option:

Array
(
    [typemap] => Array
        (
            [root] => array
            [document] => array
        )
    [typeMap] => Array
        (
            [array] => MongoDB\Model\BSONArray
            [document] => MongoDB\Model\BSONDocument
            [root] => MongoDB\Model\BSONDocument
        )
)

Change row 319 to:

$driverOptions['typeMap'] = ['root' => 'array', 'document' => 'array'];

and the problem is solved.

@jmikola
Copy link
Member

jmikola commented Oct 30, 2018

@alcaeus: This does look like a typo in the bundle. The correct option name is typeMap in $driverOptions.

@zaerl
Copy link
Author

zaerl commented Nov 16, 2018

Thanks.

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

No branches or pull requests

2 participants