If we look at the code of sfDoctrineDatabase.class.php, the "attributes"
node needs to be in the param section. I think if you try some others
attributes instead of "query_cache", they will be set correctly.

I think the problem is especially for this query_cache attribute. According
to the Doctrine documentation, for setting the cache you have to do for
example

$cacheDriver = new Doctrine_Cache_Apc();
$conn->setAttribute(Doctrine_Core::ATTR_QUERY_CACHE, $cacheDriver);

I don't think you will be able to do a such thing only with the database.yml
file.

Did you try to listen to the doctrine.configure_connection event, and test
the sf_environment setting to set the query cache you want ?



2010/10/22 bzarzuela <[email protected]>

> I've done that as well but sadly, it didn't work.
>
> On Oct 21, 9:13 pm, Pierre-Yves LEBECQ <[email protected]> wrote:
> > Ok, what about adding an indentation level ?
> >
> > dev:
> >   doctrine:
> >     class: sfDoctrineDatabase
> >     param:
> >       dsn: mysql:host=127.0.0.1;dbname=hermes_dev
> >       username: hermes
> >       password: hermes
> >       attributes:
> >         query_cache: Doctrine_Cache_Apc
> >
> > --
> > Pierre-Yves
> >
> > 2010/10/21 bzarzuela <[email protected]>
> >
> >
> >
> > > Thanks. I tried this approach before but ended up doing a lot of
> > > conditional statements to handle the different environments my
> > > application has.
> >
> > > For example, in my dev env, I would prefer it to use the Array cache
> > > but in the production, it would use APC.
> >
> > > The code for sfDoctrineDatabase.class.php already has the logic to get
> > > it from the environment's configuration. The only question now is
> > > *where* to put the configuration.
> >
> > > On Oct 20, 4:37 pm, Pierre-Yves LEBECQ <[email protected]> wrote:
> > > > In your ProjectConfiguration class (/config), you can add a
> > > > configureDoctrine method that will receive a Doctrine_Manager
> instance
> > > and
> > > > you can set all attributes you want. You should be able to do what
> you
> > > want
> > > > this way.
> >
> > > > public function configureDoctrine(Doctrine_Manager $manager)
> > > > {
> > > >  //$manager->setAttribute();
> >
> > > > }
> >
> > > > 2010/10/19 bzarzuela <[email protected]>
> >
> > > > > Hello,
> >
> > > > > Where do you need to specify attributes for Doctrine in Symfony
> 1.4?
> >
> > > > > Line 75 of sfDoctrineDatabase.class.php is what I'm trying to
> affect.
> >
> > > > > $attributes = $this->getParameter('attributes', array());
> >
> > > > > I'm trying to set the query_cache here:
> >
> > > > > dev:
> > > > >  doctrine:
> > > > >    class: sfDoctrineDatabase
> > > > >    param:
> > > > >      dsn: mysql:host=127.0.0.1;dbname=hermes_dev
> > > > >      username: hermes
> > > > >      password: hermes
> > > > >    attributes:
> > > > >      query_cache: Doctrine_Cache_Apc
> >
> > > > > However, var_dumping the value of $attributes results in an empty
> > > > > array.
> >
> > > > > My end goal here is to enable the query cache with different
> drivers
> > > > > for the different environments the application will be running.
> >
> > > > > What's the best way of doing this?
> >
> > > > > --
> > > > > 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
> [email protected]
> > > > > To unsubscribe from this group, send email to
> > > > > [email protected]<symfony-users%[email protected]>
> <symfony-users%2bunsubscr...@goog legroups.com>
> > > <symfony-users%2bunsubscr...@goog legroups.com>
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/symfony-users?hl=en
> >
> > > --
> > > 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 [email protected]
> > > To unsubscribe from this group, send email to
> > > [email protected]<symfony-users%[email protected]>
> <symfony-users%2bunsubscr...@goog legroups.com>
> > > For more options, visit this group at
> > >http://groups.google.com/group/symfony-users?hl=en
>
> --
> 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 [email protected]
> To unsubscribe from this group, send email to
> [email protected]<symfony-users%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>

-- 
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to