Issues

ZF-11431: zf create db-table.from-database doesn't work

Description

This command doesn't work and it doesn't give an error. It fails horribly.

Here's some output:

[renich@introdesk test]$ cat application/configs/application.ini [production] phpSettings.display_startup_errors = 0 phpSettings.display_errors = 0 includePaths.library = APPLICATION_PATH "/../library" bootstrap.path = APPLICATION_PATH "/Bootstrap.php" bootstrap.class = "Bootstrap" appnamespace = "Application" resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers" resources.frontController.params.displayExceptions = 0

resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"

resources.db.params.mysql'adapter = "PDO_MYSQL" resources.db.params.host = "localhost" resources.db.params.dbname = "zf_test" resources.db.params.user = "zf_test" resources.db.params.password = "password"

[staging : production]

[testing : production] phpSettings.display_startup_errors = 1 phpSettings.display_errors = 1

[development : production] phpSettings.display_startup_errors = 1 phpSettings.display_errors = 1 resources.frontController.params.displayExceptions = 1 [renich@introdesk test]$ zf create db-table.from-database PHP Fatal error: Call to a member function listTables() on a non-object in /usr/share/pear/Zend/Tool/Project/Provider/DbTable.php on line 166 PHP Stack trace: PHP 1. {main}() /usr/share/pear/zf.php:0 PHP 2. ZF::main() /usr/share/pear/zf.php:623 PHP 3. ZF->run() /usr/share/pear/zf.php:74 PHP 4. ZF->_runTool() /usr/share/pear/zf.php:117 PHP 5. Zend_Tool_Framework_Client_Abstract->dispatch() /usr/share/pear/zf.php:600 PHP 6. Zend_Tool_Framework_Client_Abstract->_handleDispatch() /usr/share/pear/Zend/Tool/Framework/Client/Abstract.php:241 PHP 7. Zend_Tool_Framework_Client_Abstract->_handleDispatchExecution() /usr/share/pear/Zend/Tool/Framework/Client/Abstract.php:318 PHP 8. call_user_func_array() /usr/share/pear/Zend/Tool/Framework/Client/Abstract.php:324 PHP 9. Zend_Tool_Project_Provider_DbTable->createFromDatabase() /usr/share/pear/Zend/Tool/Framework/Client/Abstract.php:324

Fatal error: Call to a member function listTables() on a non-object in /usr/share/pear/Zend/Tool/Project/Provider/DbTable.php on line 166

Call Stack: 0.0010 794568 1. {main}() /usr/share/pear/zf.php:0 0.0010 794568 2. ZF::main() /usr/share/pear/zf.php:623 0.0037 1247488 3. ZF->run() /usr/share/pear/zf.php:74 0.0037 1247488 4. ZF->_runTool() /usr/share/pear/zf.php:117 0.0046 1368720 5. Zend_Tool_Framework_Client_Abstract->dispatch() /usr/share/pear/zf.php:600 0.0882 7921456 6. Zend_Tool_Framework_Client_Abstract->_handleDispatch() /usr/share/pear/Zend/Tool/Framework/Client/Abstract.php:241 0.0883 7922024 7. Zend_Tool_Framework_Client_Abstract->_handleDispatchExecution() /usr/share/pear/Zend/Tool/Framework/Client/Abstract.php:318 0.0883 7922464 8. call_user_func_array() /usr/share/pear/Zend/Tool/Framework/Client/Abstract.php:324 0.0883 7922888 9. Zend_Tool_Project_Provider_DbTable->createFromDatabase() /usr/share/pear/Zend/Tool/Framework/Client/Abstract.php:324

[renich@introdesk test]$ mysql -u zf_test -p zf_test; Enter password: Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 7 Server version: 5.5.12 MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show tables; +-------------------+ | Tables_in_zf_test | +-------------------+ | albums | +-------------------+ 1 row in set (0.00 sec)

Comments

In Bootstrap::_initDb add to last line:

return $this->getPluginResource('db')->getDbAdapter();

Maybe try change this line: resources.db.params.mysql'adapter = "PDO_MYSQL" to: resources.db.adapter = "PDO_MYSQL"

This actually worked... changing to db.adapter, that is...