| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!-- Reviewed: no -->
- <sect2 id="zend.application.available-resources.session">
- <title>Zend_Application_Resource_Session</title>
- <para>
- <classname>Zend_Application_Resource_Session</classname> allows you to configure
- <classname>Zend_Session</classname> as well as optionally initialize a session
- SaveHandler.
- </para>
- <para>
- To set a session save handler, simply pass the <property>saveHandler</property>
- (case insensitive) option key to the resource. The value of this option
- may be one of the following:
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <type>String</type>: A string indicating a class implementing
- <classname>Zend_Session_SaveHandler_Interface</classname> that should be
- instantiated.
- </para>
- </listitem>
- <listitem>
- <para>
- <type>Array</type>: An array with the keys "class" and, optionally,
- "options", indicating a class implementing
- <classname>Zend_Session_SaveHandler_Interface</classname> that should be
- instantiated and an array of options to provide to its constructor.
- </para>
- </listitem>
- <listitem>
- <para>
- <classname>Zend_Session_SaveHandler_Interface</classname>: an object
- implementing this interface.
- </para>
- </listitem>
- </itemizedlist>
- <para>
- Any other option keys passed will be passed to
- <methodname>Zend_Session::setOptions()</methodname> to configure
- <classname>Zend_Session</classname>.
- </para>
- <example id="zend.application.available-resources.session.configExample">
- <title>Sample Session resource configuration</title>
- <para>
- Below is a sample <acronym>INI</acronym> snippet showing how to configure the session
- resource. It sets several <classname>Zend_Session</classname> options, as well
- as configures a <classname>Zend_Session_SaveHandler_DbTable</classname> instance.
- </para>
- <programlisting language="ini"><![CDATA[
- resources.session.save_path = APPLICATION_PATH "/../data/session"
- resources.session.use_only_cookies = true
- resources.session.remember_me_seconds = 864000
- resources.session.saveHandler.class = "Zend_Session_SaveHandler_DbTable"
- resources.session.saveHandler.options.name = "session"
- resources.session.saveHandler.options.primary[] = "session_id"
- resources.session.saveHandler.options.primary[] = "save_path"
- resources.session.saveHandler.options.primary[] = "name"
- resources.session.saveHandler.options.primaryAssignment[] = "sessionId"
- resources.session.saveHandler.options.primaryAssignment[] = "sessionSavePath"
- resources.session.saveHandler.options.primaryAssignment[] = "sessionName"
- resources.session.saveHandler.options.modifiedColumn = "modified"
- resources.session.saveHandler.options.dataColumn = "session_data"
- resources.session.saveHandler.options.lifetimeColumn = "lifetime"
- ]]></programlisting>
- </example>
- <note>
- <title>Bootstrap your database first!</title>
- <para>
- If you are configuring the
- <classname>Zend_Session_SaveHandler_DbTable</classname> session save
- handler, you must first configure your database connection for it to
- work. Do this by either using the <link
- linkend="zend.application.available-resources.db">Db</link>
- resource -- and make sure the "<property>resources.db</property>" key comes prior to
- the "<property>resources.session</property>" key -- or by writing your own resource
- that initializes the database, and specifically sets the default
- <classname>Zend_Db_Table</classname> adapter.
- </para>
- </note>
- </sect2>
|