0
votes

I'm using Symfony 1.4 with Doctrine 1.2 and I've got the following databases.yml:

all:
  doctrine:
    class: sfDoctrineDatabase
    param:
      dsn:      xxxxx
      username: xxxxx
      password: xxxxx
      attributes:
         cascade_saves: false

I was under the impression that using the above would set ATTR_CASCADE_SAVES in Doctrine to false, but having run into some issues with freeing objects, I'm noticing that it actually remains true.

Var_dumping the following in any action file:

Doctrine_Manager::getInstance()->getAttribute(Doctrine::ATTR_CASCADE_SAVES);

... gives me (bool)true. Explicity setting it to false with setAttribute() fixes it, but I don't want to call this in several places in my code. Incidentally, setting it to false fixes the problems I'm having with freeing certain objects after saving.

Can anyone advise me on the correct databases.yml syntax for disabling cascading saves, or am I looking at this wrong somewhow? I can't seem to find anything useful via Google.

Thanks in advance.

1

1 Answers

1
votes

Looks correct to me - but I do things a slightly different way .... Create a new function in your config/ProjectConfiguration.class.php file ->

public function configureDoctrineConnectionDoctrine(Doctrine_Connection $connection)
{
  $connection->setAttribute('CASCADE_SAVES', false);
}

you will need to change the function name to match your connection name ... (just then end "Doctrine" part)