Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 758629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:30:07+00:00 2026-05-14T15:30:07+00:00

First some basic info: Ubuntu latest version Zend Framewrok 1.9.6 Doctrine 1.2.1 Php unit

  • 0

First some basic info:

  • Ubuntu latest version
  • Zend Framewrok 1.9.6
  • Doctrine 1.2.1
  • Php unit latest version

I have been following this and thistutorial to set up my zend envrionment with doctrine and phpUnit.

My environment is not an emtpy project since I had done some developments before I
configured doctrine and phpunit. I have created some db classes in my models/DbTable/ folder.
The problem is that the files in this folder cause a problem by running phpunit.

This is the error I get:

    Fatal error: Cannot redeclare class JS_Model_DBTable_Addresses in /var/www/nrka/application/models/DbTable/addresses.php on line 19

Call Stack:
    0.0007      62480   1. {main}() /usr/bin/phpunit:0
    0.1662    4484880   2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:52
    0.1663    4485612   3. PHPUnit_TextUI_Command->run() /usr/share/php/PHPUnit/TextUI/Command.php:147
    0.1663    4485860   4. PHPUnit_TextUI_Command->handleArguments() /usr/share/php/PHPUnit/TextUI/Command.php:156
    0.1678    4491132   5. PHPUnit_Util_Fileloader::load() /usr/share/php/PHPUnit/TextUI/Command.php:786
    0.1682    4504132   6. include_once('/var/www/nrka/tests/application/bootstrap.php') /usr/share/php/PHPUnit/Util/Fileloader.php:117
    0.2773    7249284   7. Doctrine_Cli->run() /var/www/nrka/tests/application/bootstrap.php:33
    0.2773    7249348   8. Doctrine_Cli->_run() /var/www/nrka/library/Doctrine/Cli.php:452
    0.2789    7259336   9. Doctrine_Cli->executeTask() /var/www/nrka/library/Doctrine/Cli.php:498
    0.2790    7259480  10. Doctrine_Task_BuildAllReload->execute() /var/www/nrka/library/Doctrine/Cli.php:516
    0.5301   11487988  11. Doctrine_Task_LoadData->execute() /var/www/nrka/library/Doctrine/Task/BuildAllReload.php:56
    0.5312   11488028  12. Doctrine_Core::loadData() /var/www/nrka/library/Doctrine/Task/LoadData.php:43
    0.5324   11527112  13. Doctrine_Data->importData() /var/www/nrka/library/Doctrine/Core.php:996
    0.5372   11641772  14. Doctrine_Data_Import->doImport() /var/www/nrka/library/Doctrine/Data.php:222
    0.5375   11642232  15. Doctrine_Data->purge() /var/www/nrka/library/Doctrine/Data/Import.php:115
    0.5375   11642300  16. Doctrine_Core::getLoadedModels() /var/www/nrka/library/Doctrine/Data.php:263
    0.5382   11690076  17. Doctrine_Core::filterInvalidModels() /var/www/nrka/library/Doctrine/Core.php:716
    0.5544   11710976  18. Doctrine_Core::isValidModelClass() /var/www/nrka/library/Doctrine/Core.php:763
    0.5544   11711084  19. class_exists() /var/www/nrka/library/Doctrine/Core.php:784
    0.5546   11711456  20. Doctrine_Core::modelsAutoload() /var/www/nrka/library/Doctrine/Core.php:0

What I think that is happening is that the autoloaders of zend Framework, Doctrine and PHPunit are disturbing each other but I am not sure about it.

Btw. Line 19 of the above file (addresses.ph) is the last line of that file. I have checked other locations wether it’s manually included somewhere else but as far as I can see it isn’t

This is how my application.ini looks like:

production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0

phpSettings.date.timezone = "Europe/Amsterdam"

includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.layout.layoutpath = APPLICATION_PATH "/layouts"
resources.view.basePath = /var/www/nrka/public/
autoloaderNamespaces[] = "Doctrine"
autoloaderNamespaces0 = "JS_"

;---------
;databases
;---------
doctrine.dsn = "mysql://root:root@localhost/zcdev"
doctrine.data_fixtures_path = APPLICATION_PATH "/configs/data/fixtures"
doctrine.sql_path           = APPLICATION_PATH "/configs/data/sql"
doctrine.migrations_path    = APPLICATION_PATH "/configs/migrations"
doctrine.yaml_schema_path   = APPLICATION_PATH "/configs/schema.yml"
doctrine.models_path        = APPLICATION_PATH "/models"

resources.db.isDefaultTableAdapter = true
resources.db.adapter =  mysqli
resources.db.params.host    = localhost
resources.db.params.username = root
resources.db.params.password = root
resources.db.params.dbname = ladosa



[staging : production]

[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
doctrine.dsn = "mysql://root:root@localhost/zctest"

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

It might give some extra info.

So I am curious to know if anyone has a solution for me.

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T15:30:08+00:00Added an answer on May 14, 2026 at 3:30 pm

    I temporarily solved the problem by using passthru and therefore running the Doctrine Cli outside the PHP environment.
    Probably it is far away from being a good stable solution but until come up with something else, this is how i do it:

    <?php
    ...
    $tmpDir = realpath(getcwd());
    $newDir = realpath(dirname(__FILE__).'/../../application/scripts/');
    chdir($newDir);
    passthru('./doctrine build-all-reload -force');
    chdir($tmpDir);
    

    To explain this: I store the path i am in and then generate the path where my doctrine Cli executeable script is. Then i change to that directory. passthru executes the build-all-reload command, using the -force because of the "Do you really want to …" question.
    And then i cahnge to the original directory again.

    This provides me with a fresh Database containing all my data fixtures. You can start this little code whenever you want.
    Combined with the Solution in the Article Database helper for PHPUnit on CodeUtopia, this works really nice.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working through the Stanford iPhone podcasts and have some basic questions. The first:
I am writing my first Wordpress custom plugin, and I've entered some basic info
I'm building a basic forum where every post contains some text, first and last
Hi and thanks for your attention. First some background on the question: I have
Today i have a little problem containing a File Upload. First some Infos: Rubyversion:
Hey im working on my first php site, and was hoping to get some
I'm at my first experiences with iPhone development. I wrote some basic code to
First, basic info on our environment: We're using c# .net 4.0, on Win7-x64, targeting
This is my first post. I'm trying to do some basic meta-programming with javascript,
First some background, I've written an open source .NET library, named Duplicitiy (on github.com),

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.