MysqlSchemaParser ForeignTable not found #529

Closed
marcj opened this Issue Jan 27, 2014 · 2 comments

Projects

None yet

2 participants

@marcj
Member
marcj commented Jan 27, 2014

I get following error when there's a FOREIGN KEY to a non-existing table:

PHP Fatal error:  Call to a member function getColumn() on a non-object in /Users/marc/bude/symfony-24/src/Kryn/CmsBundle/vendor/propel/propel/src/Propel/Generator/Reverse/MysqlSchemaParser.php on line 316
PHP Stack trace:
PHP   1. {main}() /Users/marc/bude/symfony-24/src/Kryn/CmsBundle/Tests/Integration/skeletion/app/console:0
PHP   2. Symfony\Component\Console\Application->run() /Users/marc/bude/symfony-24/src/Kryn/CmsBundle/Tests/Integration/skeletion/app/console:29
PHP   3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() /Users/marc/bude/symfony-24/src/Kryn/CmsBundle/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:123
PHP   4. Symfony\Component\Console\Application->doRun() /Users/marc/bude/symfony-24/src/Kryn/CmsBundle/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:96
PHP   5. Symfony\Component\Console\Application->doRunCommand() /Users/marc/bude/symfony-24/src/Kryn/CmsBundle/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:192
PHP   6. Symfony\Component\Console\Command\Command->run() /Users/marc/bude/symfony-24/src/Kryn/CmsBundle/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:900
PHP   7. Kryn\CmsBundle\Command\BuildCommand->execute() /Users/marc/bude/symfony-24/src/Kryn/CmsBundle/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:252
PHP   8. Kryn\CmsBundle\ORM\Builder\Builder->build() /Users/marc/bude/symfony-24/src/Kryn/CmsBundle/Command/BuildCommand.php:30
PHP   9. Kryn\CmsBundle\ORM\Builder\Propel->build() /Users/marc/bude/symfony-24/src/Kryn/CmsBundle/ORM/Builder/Builder.php:127
PHP  10. Kryn\CmsBundle\Propel\PropelHelper->init() /Users/marc/bude/symfony-24/src/Kryn/CmsBundle/ORM/Builder/Propel.php:104
PHP  11. Kryn\CmsBundle\Propel\PropelHelper->fullGenerator() /Users/marc/bude/symfony-24/src/Kryn/CmsBundle/Propel/PropelHelper.php:69
PHP  12. Kryn\CmsBundle\Propel\PropelHelper->updateSchema() /Users/marc/bude/symfony-24/src/Kryn/CmsBundle/Propel/PropelHelper.php:134
PHP  13. Kryn\CmsBundle\Propel\PropelHelper->getSqlDiff() /Users/marc/bude/symfony-24/src/Kryn/CmsBundle/Propel/PropelHelper.php:421
PHP  14. Symfony\Component\Console\Command\Command->run() /Users/marc/bude/symfony-24/src/Kryn/CmsBundle/Propel/PropelHelper.php:555
PHP  15. Propel\Generator\Command\MigrationDiffCommand->execute() /Users/marc/bude/symfony-24/src/Kryn/CmsBundle/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:252
PHP  16. Propel\Generator\Reverse\MysqlSchemaParser->parse() /Users/marc/bude/symfony-24/src/Kryn/CmsBundle/vendor/propel/propel/src/Propel/Generator/Command/MigrationDiffCommand.php:107
PHP  17. Propel\Generator\Reverse\MysqlSchemaParser->addForeignKeys() /Users/marc/bude/symfony-24/src/Kryn/CmsBundle/vendor/propel/propel/src/Propel/Generator/Reverse/MysqlSchemaParser.php:125

Easy check and skip then in Propel/Generator/Reverse/MysqlSchemaParser.php:313 should do the trick.

@staabm
Member
staabm commented Jan 27, 2014

Instead of skipping the column I would prefer a more meaningfull exception, so the user immediatly can fix the error

@marcj
Member
marcj commented Jan 27, 2014

I don't think throwing a exception here is helpful. When a foreign-key definition is wrong in the current schema of the database then we should skip over that broken parts like we already do in other cases where we detect broken stuff. Also because 'fixing that error' is not always possible.

@marcj marcj added this to the alpha-3 milestone Mar 13, 2014
@marcj marcj closed this in 4cc5092 Apr 11, 2014
@mpscholten mpscholten added a commit to mpscholten/Propel2 that referenced this issue Aug 24, 2014
@marcj @mpscholten marcj + mpscholten Fixed #529 - MysqlSchemaParser ForeignTable not found 916b3a8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment