Hi Andries,
So you have suggested adding array_merge() to
Zend_Session_Namespace.
The first thought I have then, is "where do we draw a
line between
adding array_*() convenience functions to
Zend_Session_Namespace". I
see the value in PHP's array_* functions. Although several
of these are
not relevant to Zend_Session_Namespace, many could be
applied. I am
wary of adding these functions, one by one to Zend_Session.
Zend_Session_Namespace's support for the expiring elements
poses
difficulties to achieving an extremely simple
implementation, if support
for the expiring data is included. One possible approach
(untested)
that ignores the expiring data:
http:
//framework.zend.com/issues/browse/ZF-1139
The two new functions could easily be factored to a userland
subclass of
Zend_Session_Namespace.
Cheers,
Gavin
P.S. Crossing posting to fw-auth (the home mailing list for
Zend_Session).
Andries Seutens wrote:
> ps: i can take a shot at it if you like. shouldn't be
too hard.
>
> Best,
>
> Andriesss
>
> Andries Seutens schreef:
>> Yep, key value paris it is.
>>
>> Best,
>>
>> Andriesss
>>
>> Gavin Vess schreef:
>>> Just to confirm .. $privileges is an array? So
you are asking for a
>>> convenience function to merge an existing array
of key => value
>>> pairs with a session namespace?
>>>
>>> Cheers,
>>> Gavin
>>>
>>> Andries Seutens wrote:
>>>> Hello all,
>>>>
>>>> I am porting our company's framework to the
Zend Framework, and I
>>>> was looking into Zend Session, while I
noticed that it would be
>>>> very usefull to have some sort of
::setFrom() method.
>>>>
>>>> Take the following scenario:
>>>>
>>>> ---
>>>> $permissionNamespace = new
>>>>
Zend_Session_Namespace($config->namespace->permissions
);
>>>>
>>>> $priveledges =
$userModel->getPermissions();
>>>> ---
>>>>
>>>> Currently, i see no convenience way for
getting $priveledges in the
>>>> $permissionNamespace, unless I am missing
something?
>>>>
>>>> Having a ::setFrom() method, which takes an
array as input, would
>>>> solve this by doing:
>>>>
>>>> ---
>>>> $permissionNamespace = new
>>>>
Zend_Session_Namespace($config->namespace->permissions
);
>>>>
>>>> $priveledges =
$userModel->getPermissions();
>>>>
$permissionNamespace->setFrom($priveledges);
>>>>
>>>>
var_dump($permissionNamespace->controller->action));
>>>> ---
>>>>
>>>> What do you guys think?
>>>>
>>>> Best,
>>>>
>>>>
>>>> Andries
|