History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: ZF-2103
Type: Improvement Improvement
Status: Closed Closed
Resolution: Won't Fix
Priority: Major Major
Assignee: Ralph Schindler
Reporter: Shekar Reddy
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Google issue summary
Zend Framework

Zend_Session_Namespace - Optional argument to create namespace in deeper nodes

Created: 26/Oct/07 10:57 AM   Updated: 10/Jan/09 10:20 AM
Component/s: Zend_Session
Affects Version/s: 1.0.2
Fix Version/s: 1.8.0

Time Tracking:
Original Estimate: 4 days
Original Estimate - 4 days
Remaining Estimate: 4 days
Remaining Estimate - 4 days
Time Spent: Not Specified
Remaining Estimate - 4 days

 Public Fields   Internal Project Management Fields   
Tags:
Participants: Ralph Schindler, Shekar Reddy and Wil Sinclair
Fix Version Priority: Nice to Have


 Description  « Hide
Currently, the namespace component creates namespaces only at the root of the session:
$user = new Zend_Session_Namespace( 'user' );

=> $_SESSION['user'] = array()

What if I want to store data deeper in the auth node to just group it and reduce clutter (aka modules) and to be able to count the number of items/namespaces in a node:

$_SESSION['auth']['user']['id'] = 1;
([node][namespace][key] = value)

In the above case, it would be much more powerful to be able to create the namespace under the 'auth' node so we could configure the keys in the 'user' namespace. We could introduce an optional 'node' argument to the Zend_Session_Namespace::__construct(), like so:

$user = new Zend_Session_Namespace( 'user', 'auth' );
[create the user namespace under auth node - auth node created automatically if it does not exist in session]

We can even go as deeper as we could by specifying an intelligent node-path:

$user = new Zend_Session_Namespace( 'user', 'auth:node2:node3' );
(create the user namespace under $_SESSION[auth][node2][node3] - all created automatically if they do not exist in session)

I guess the above feature adds more muscle to the namespace component and enables us to use it more powerfully.

Thoughts...?



 All   Comments   Work Log   Change History   FishEye   Crucible      Sort Order: Ascending order - Click to sort in descending order
Wil Sinclair - 18/Apr/08 01:11 PM
This doesn't appear to have been fixed in 1.5.0. Please update if this is not correct.

Ralph Schindler - 21/Jul/08 02:08 PM
How does this benefit over using a smarter naming convention for the namespaces? For example like
$user = new Zend_Session_Namespace("user-auth");

OR over

$user = new Zend_Session_Namespace("user-auth"); 
$user->auth->node2 = 'value';

?

The bigger problem with adding more/deeper nodes is that the serialized version will take up more space in the file/database whatever.

Ill categorize as nice to have / next minor, but at currently I am not completely convinced yet. Perhaps talk it over in #zftalk.dev with some other people.

-ralph


Shekar Reddy - 12/Aug/08 06:29 PM
That's what I've been doing these days but it involves a lot of consistent code and work to maintain data in appropriate nodes. If we have the namespace created in a deeper node, keys added to the namespace automatically appear in the child node of the namespaced node and so it becomes much easier to maintain data and focus on business logic. Furthermore, the items under the namespace node can now be counted, can be disabled from adding more keys than a specified threshold, configured to expire, etc. and so we can create categorized namespaces with typical behaviors for the data inside the namespaces.

Ralph Schindler - 10/Jan/09 10:20 AM
Interesing feature, but I am not sure we'll have time to implement this within the 1.0 branch.

We concede that this component needs a rewrite, so ideas are being logged here:

http://framework.zend.com/wiki/display/ZFDEV/Zend_Session+2.0