Skip to content

Loading…

DDC-186: addIndex is borken in trunk since this morning update #2521

Closed
doctrinebot opened this Issue · 13 comments

2 participants

@doctrinebot

Jira issue originally created by user rickdt:

Warning: Illegal offset type in isset or empty in /home/eric/Zend/workspaces/DefaultWorkspace7/fna/lib/Doctrine/DBAL/Schema/Table.php on line 183

Call Stack:
    0.0003     328176   1. {main}() /home/eric/Zend/workspaces/DefaultWorkspace7/fna/application/scripts/tool.php:0
    0.0046     708968   2. Kronos\Common\ToolRunner->run() /home/eric/Zend/workspaces/DefaultWorkspace7/fna/application/scripts/tool.php:31
    0.0094     990020   3. Kronos\Common\Tool->run() /home/eric/Zend/workspaces/DefaultWorkspace7/fna/lib/Kronos/Common/ToolRunner.php:92
    0.0094     990020   4. Kronos\FNA\Tool\CreateDatabase->runTool() /home/eric/Zend/workspaces/DefaultWorkspace7/fna/lib/Kronos/Common/Tool.php:223
    0.0094     990020   5. Kronos\FNA\Tool\CreateDatabase::CreateDatabase() /home/eric/Zend/workspaces/DefaultWorkspace7/fna/application/Kronos/FNA/Tool/CreateDatabase.php:18
    0.7140   10032764   6. Doctrine\ORM\Tools\SchemaTool->createSchema() /home/eric/Zend/workspaces/DefaultWorkspace7/fna/application/Kronos/FNA/Tool/CreateDatabase.php:45
    0.7140   10032764   7. Doctrine\ORM\Tools\SchemaTool->getCreateSchemaSql() /home/eric/Zend/workspaces/DefaultWorkspace7/fna/lib/Doctrine/ORM/Tools/SchemaTool.php:81
    0.7140   10032764   8. Doctrine\ORM\Tools\SchemaTool->getSchemaFromMetadata() /home/eric/Zend/workspaces/DefaultWorkspace7/fna/lib/Doctrine/ORM/Tools/SchemaTool.php:98
    0.7184   10339688   9. Doctrine\DBAL\Schema\Table->addIndex() /home/eric/Zend/workspaces/DefaultWorkspace7/fna/lib/Doctrine/ORM/Tools/SchemaTool.php:197
    0.7184   10339744  10. Doctrine\DBAL\Schema\Table->_createIndex() /home/eric/Zend/workspaces/DefaultWorkspace7/fna/lib/Doctrine/DBAL/Schema/Table.php:150

@doctrinebot

Comment created by @beberlei:

This happens because of the totally unused syntax:

$indexColumns = array("foo" => array(), "bar" => array());

This syntax was removed in favour of:

$indexColumns = array("foo", "bar");
@doctrinebot

Comment created by rickdt:

How do we use this syntax in Metadata ??

I do ;

@Table(name="xxxxxxx",indexes={@index(name="idx*record_id", columns={"record*id"})})
@doctrinebot

Comment created by rickdt:

..

@doctrinebot

Comment created by rickdt:

I really would like to use the good syntax. I even asked for a better documentation in DDC-160

@doctrinebot

Comment created by @beberlei:

Hm it seems the metadata drivers make this. This only means index creation is not tested in the unittests :-)

I'll add a temporary fix, and discuss it in the team how to solve this consistently.

@doctrinebot

Comment created by @beberlei:

Can you try again with trunk?

@doctrinebot

Comment created by rickdt:

There is a new error

An unknown column-name columns was given.
#0 /home/eric/Zend/workspaces/DefaultWorkspace7/fna/lib/Doctrine/DBAL/Schema/Table.php(188): Doctrine\DBAL\Schema\SchemaException::columnDoesNotExist('columns')
#1 /home/eric/Zend/workspaces/DefaultWorkspace7/fna/lib/Doctrine/DBAL/Schema/Table.php(150): Doctrine\DBAL\Schema\Table->*createIndex(Array, 'idx_record*id', false, false)
#2 /home/eric/Zend/workspaces/DefaultWorkspace7/fna/lib/Doctrine/ORM/Tools/SchemaTool.php(197): Doctrine\DBAL\Schema\Table->addIndex(Array, 'idx*record*id')
#3 /home/eric/Zend/workspaces/DefaultWorkspace7/fna/lib/Doctrine/ORM/Tools/SchemaTool.php(98): Doctrine\ORM\Tools\SchemaTool->getSchemaFromMetadata(Array)
#4 /home/eric/Zend/workspaces/DefaultWorkspace7/fna/lib/Doctrine/ORM/Tools/SchemaTool.php(81): Doctrine\ORM\Tools\SchemaTool->getCreateSchemaSql(Array)
#5 /home/eric/Zend/workspaces/DefaultWorkspace7/fna/application/Kronos/FNA/Tool/CreateDatabase.php(46): Doctrine\ORM\Tools\SchemaTool->createSchema(Array)

I will try to get you more informations.

@doctrinebot

Comment created by rickdt:

Here is the content of columnNames

Array
(
    [0] => id
)
Array
(
    [columns] => Array
        (
            [0] => record_id
        )

)
@doctrinebot

Comment created by rickdt:

After some verification all Mapping Driver generate the index definitions this way

if ($tableAnnot->indexes !== null) {
                foreach ($tableAnnot->indexes as $indexAnnot) {
                    $primaryTable['indexes'][$indexAnnot->name] = array('columns' => $indexAnnot->columns);
                }
            }
@doctrinebot

Comment created by @beberlei:

Ok, that could be changed easily i guess.

@doctrinebot

Comment created by @beberlei:

Fixed, added a test-case.

@doctrinebot

Issue was closed with resolution "Fixed"

@doctrinebot

Comment created by rickdt:

Thank you! I confirm this fixed the issue.

@beberlei beberlei was assigned by doctrinebot
@doctrinebot doctrinebot added this to the 2.0-ALPHA4 milestone
@doctrinebot doctrinebot closed this
@doctrinebot doctrinebot added the Bug label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.