I got it working, by erasing the contents of the database, not
dropping it. Then, I somehow had some dangling code lines <uknowing
shrug> that creeped in, and then it didn't work.

Many many hours later, after reverting to the old working version, I
then came to the conclusion about the extra code line.

Summary, DON'T drop the database, just erase all the contents, and
redo the fixture file to do PHPUnit tests. I did it like this:

//PHPUnit templated method
//Called before every method of your PHPUnit extending class
//
  public function setUp(){
    $this->prepareDb();
  }


//This could be done in a Transaction instead,
//and not worrying about the order
//HOwever, the schema file would have to have 'cascade: [delete]'
//for every relationship, [recommended]
//
//set up for postgres, the sequences give it away
//
 protected function prepareDb(){
    $sql=array();
    $sql[]="delete from lowest_child_table";
    $sql[]="alter sequence lowest_child_id_seq restart";

    $sql[]="delete from parent_of_lowest_child";
    $sql[]="alter sequence parent_ofLoest_child_id_seq restart";

    $sql[]="delete from uncle_of_lowest_child";
    $sql[]="alter sequence uncle_of_lowest_child_id_seq restart";

    $sql[]="delete from grandparent";
    $sql[]="alter grandparent_id_seq restart";

    $PDOdbh = Doctrine_Manager::getInstance()->getCurrentConnection()-
>getDbh();

    foreach( $sql as $do ){
      $PDOdbh->query($do);
    }
    chdir(sfConfig::get('sf_root_dir'));// makes PHP run next commands
in project dir
    exec('./symfony doctrine:data-load');
    exec('./symfony cc');

  }

}


On Jul 11, 12:15 am, Dennis <gear...@sbcglobal.net> wrote:
> Wow, I guess I've been a member of this group for a while and forgot
> about it. I'll have to check my settings and see why I don't even get
> digest.
>
> BUT, as to my code problem, I found it. It was the interface unit
> between the keyboard and the screen . . me. I had added 'createdb'
> privilege to my non superuser user on the production box, but not the
> dev box.
>
> Found this out by digging DEEP into the Doctrine code. And yes,
> SEVERAL databases have a default database to hook to. Doctrine uses
> the 'postgres' database in a 'temporary' connection that it
> manufactures. After the database is created, it kills that connection
> and reconnects to the new database as the owner.
>
> It's in: ./project_directory/lib/vendor/symfony/lib/plugins/
> sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/connection.php
>
> Using the dicrectory driven class defintion, that becomes
> 'Doctrine_Connection' class.
>
> In Doctrine 1.2 (Symfony 1.4.1) it's on line 1467 (the temporary
> connection call) and the temporary connecton is created on line on
> line 1510. Search for '$pdoDsn .= ';dbname=' . $this->export-
>
> >tmpConnectionDatabase'
>
> Nice coding by the Doctrine team.
>
> On Jul 10, 8:51 pm, Dennis Gearon <gear...@sbcglobal.net> wrote:
>
> > Using Symfony and Doctrine, the dev cycle is:
>
> > write yaml file with schema
> > generate (or skip above and write doctrine) classes
> > drop the current database
> > create new database
> > load schema
> > load data
> > run tests.
>
> > I can seem to get past dropping the database. I'm using a non superuser 
> > with CREATEDB privileges. After dropping the database, it has no other 
> > database to connect to. So Doctrine can't connect. How do I get around this?
>
> > I can connect to template1 using psql command line and create a database 
> > fine. Doctrine doesn't seem to go through that step, I believe.
>
> > BTW, NEVER knew you guys were around. So glad to find this group. Most of 
> > the other people out there don't talk Postgres. It's Mysql, Mysql, Mysql. 
> > Blech!
>
> > Dennis Gearon
>
> > Signature Warning
> > ----------------
> > EARTH has a Right To Life,
> >   otherwise we all die.
>
> > Read 'Hot, Flat, and Crowded'
> > Laugh athttp://www.yert.com/film.php
>
>

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to