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

"zf generate-sql doctrine" successfully generates sql file, but this file is empty #6

Open
HongKilDong opened this issue Jun 18, 2010 · 10 comments

Comments

@HongKilDong
Copy link

I used forum.yml from readme for testing - model was generated successfully, but when I issued "zf generate-sql doctrine" it returns:

[Doctrine] Successfully written SQL for the current schema to disc.
[Doctrine] Destination File: D:\work\zd/application/configs/sql\schema_20100618_142043.sql

but generated file named "schema_20100618_142043.sql" was empty

@nunthrey
Copy link

try 'zf show doctrine'. How many models it'll show?

@HongKilDong
Copy link
Author

'zf show doctrine' returns:

[Doctrine] Current Doctrine Model Directories:
[Doctrine] * Module default: D:\work\zd/application/\models\

[Doctrine] All current models:

[Doctrine] The current migration version is: 0

In spite of the fact I have successfully generated model files in 'D:\work\zd\application\models'

@nunthrey
Copy link

I guess, you forgot to initialize module auotoloaders in bootstrap like this:

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    public function _initModuleLoaders()
    {
        $this->bootstrap('Frontcontroller');

        $fc = $this->getResource('Frontcontroller');
        $modules = $fc->getControllerDirectory();

        foreach ($modules AS $module => $dir) {
            $moduleName = strtolower($module);
            $moduleName = str_replace(array('-', '.'), ' ', $moduleName);
            $moduleName = ucwords($moduleName);
            $moduleName = str_replace(' ', '', $moduleName);

            $loader = new Zend_Application_Module_Autoloader(array(
                'namespace' => $moduleName,
                'basePath' => realpath($dir . "/../"),
            ));
        }
    }
}

@HongKilDong
Copy link
Author

I haven't used modules - I've just changed all "Forum_" prefixes to "Default_" in model entities' names in my .yml schema file - so I think I don't need module autoloaders - my model files have been generated in default application model's directory.

Moreover I'am sure it successfully locates model files as I can see it with FileMon utility.

By the way - is there a way to debug cli php - because it reports no error-warnings neither to apache's error log nor stdout? Where are cli php settings located?

@paramah
Copy link

paramah commented Jul 7, 2010

i have the same problem

@MarcoAlting
Copy link

I also have the same problem. And I'm using a modular setup. But I also get an error when trying to build my project:

[Doctrine] No sql queries found to create tables from.
[Doctrine] Have you generated a model from your YAML schema?

My module/model directory contain generated model classes from th YAML schema.

@taat
Copy link

taat commented Aug 27, 2010

I also had the same problem.

I'm not using Benjamin's generic module loader, so the needed classes were generated, but not loaded automatically by autoloader.

The solution is, that I forgot to create Boostrap.php for this specific module.

@pesec
Copy link

pesec commented Jan 14, 2011

I have the same problem, when trying build project, generate sql or create tables.
Models genereate, but nothing is done with database(. Jon Lebensold speaks in http://www.zendcasts.com/deep-integration-between-zend-and-doctrine-1-2/2010/01/ that model_loading_Aggressive helps with model_loading in docrinte1.2.x but that's not the case

@mfuller
Copy link

mfuller commented Jan 22, 2011

Hi
I'm using the Single Library Path and I too have the same problem when trying to generate sql or create tables. I even added the public function _initModuleLoaders()
method in my bootstrap just in case. Although I don't think I need to according to the documentation.

Using the model_loading_zend it works fine.

Thanks.

@adamkopec
Copy link

I've had a similar issue to @HongKilDong & followers. In order to fix it I've had to delete a folder that accidentally appeared in the models/ directory. Apparently this tool doesn't accept anything other than models and Base/ directory in the models folder.

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

8 participants