Development

#2998 (Different behaviour in sfDatabaseSessionStorage with databases.yml)

You must first sign up to be able to contribute.

Ticket #2998 (closed documentation: fixed)

Opened 9 months ago

Last modified 9 months ago

Different behaviour in sfDatabaseSessionStorage with databases.yml

Reported by: michael.piecko Assigned to: fabien
Priority: minor Milestone: 1.1.0
Component: configuration Version: 1.1.0 DEV
Keywords: sfDatabaseSessionStorage Cc:
Qualification: Unreviewed

Description

In symfony 1.0.x i was able to use the same database for session handling like the one defined in databases.yml

For example, databases.yml:

all:
  myDatabase:
    class:          sfPropelDatabase
    param:
      dsn:          pgsql://user:password@localhost/database

factories.yml:

  storage:
    class:          sfPostgreSQLSessionStorage
    param:
      database:     myDatabase
      ...

In symfony 1.1.0-DEV with the same setup i get an exception with "You need to pass a sfPostgreSQLDatabase to the sfPostgreSQLSessionStorage". This worked in symfony 1.0.x

In symfony 1.0.x i was also able to create a custom session storage class ("mySessionStorage" extending "sfPostgreSQLSessionStorage") in my lib folder and override the sessionWrite() method, to write some additional data in an extended session table. So my set up was like

databases.yml:

all:
  myDatabase:
    class:          sfPropelDatabase
    param:
      dsn:          pgsql://user:password@localhost/database

factories.yml:

  storage:
    class:          mySessionStorage
    param:
      database:     myDatabase
      ...

This does not work in symfony 1.1.0-DEV anymore. I get an exception "You need to pass a myDatabase to the mySessionStorage".

I think this changed a little with the introduction of sfDatabaseSessionStorage, and i know symfony 1.1.0 is still under development. But what is (or will be) in symfony 1.1.0 the right way to extend a session database class? I think this line: http://trac.symfony-project.com/browser/branches/1.1/lib/storage/sfDatabaseSessionStorage.class.php#L96 does not take into account the possibility of extended classes.

Michael

Change History

(in reply to: ↑ description ) 02/23/08 15:21:42 changed by michael.piecko

  • type changed from enhancement to documentation.

I was able to bypass this exception by placing a dummy "myDatabase" class inside the lib folder, which extends "sfPostgreSQLDatabase" in my case.

Michael

02/23/08 23:05:16 changed by fabien

  • milestone set to 1.1.0.

02/27/08 23:47:37 changed by fabien

  • status changed from new to closed.
  • resolution set to fixed.

in r7644