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

DDC-973: Undefined indexes of $tableColumn in MySqlSchemaManager.php #5509

Closed
doctrinebot opened this issue Jan 9, 2011 · 3 comments
Closed
Assignees
Labels

Comments

@doctrinebot
Copy link

Jira issue originally created by user michaelspiller:

I wanna setup my Doctrine system by running the following PHP code:
{quote}
require_once 'config.inc.php';
$schemaTool = new \Doctrine\ORM\Tools\SchemaTool($em);

$metadata = $em->getMetadataFactory()->getAllMetadata();

$schemaTool->updateSchema($metadata);
{quote}

But I get the following error:
{quote}
Notice: Undefined index: type in XXX/Doctrine/DBAL/Schema/MySqlSchemaManager.php on line 90

Fatal error: Uncaught exception 'Doctrine\DBAL\DBALException' with message 'Unknown database type requested, Doctrine\DBAL\Platforms\MySqlPlatform may not support it.' in XXX/Doctrine/DBAL/Platforms/AbstractPlatform.php:192 Stack trace: #0 XXX/Doctrine/DBAL/Schema/MySqlSchemaManager.php(109): Doctrine\DBAL\Platforms\AbstractPlatform->getDoctrineTypeMapping(false) #1 XXX/Doctrine/DBAL/Schema/AbstractSchemaManager.php(624): Doctrine\DBAL\Schema\MySqlSchemaManager->_getPortableTableColumnDefinition(Array) #2 XXX/Doctrine/DBAL/Schema/AbstractSchemaManager.php(152): Doctrine\DBAL\Schema\AbstractSchemaManager->_getPortableTableColumnList(Array) #3 XXX/Doctrine/DBAL/Schema/AbstractSchemaManager.php(222): Doctrine\DBAL\Schem in XXX/Doctrine/DBAL/Platforms/AbstractPlatform.php on line 192
{quote}

I edited MySqlSchemaManager.php by adding print_r($tableColumn); just behind line 90, so the code looks like:
{quote}
$tableColumn = array_change_key_case($tableColumn, CASE_LOWER);

    $dbType = strtolower($tableColumn['type']);

print_r($tableColumn);
$dbType = strtok($dbType, '(), ');
{quote}
and PHP returns the values of the array correctly:
{quote}
Array
(
[field] = ar_namespace
[type] = int(11)
[null] = NO
[key] = MUL
[default] = 0
[extra] =

)
{quote}

I also tried echo $tableColumn['type']; without success (result is an additional "Notice: Undefined index: type")

@doctrinebot
Copy link
Author

Comment created by @beberlei:

Can you verify the same fails on PHP 5.3.*? This seems very weird having the key in $tableColumn print_r and direct access failing. I can't explain it.

Why are you using php 6-dev anyways? It has been squased and deleted several months ago already.

@doctrinebot
Copy link
Author

Comment created by @beberlei:

No feedback was given on this issue, closing.

@doctrinebot
Copy link
Author

Issue was closed with resolution "Invalid"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants