-- Simon Walter <[email protected]> wrote (on Wednesday, 02 March 2011, 04:18 PM +0900): > I'm not sure if this is even possible, but I thought I'd ask here in case > anyone else has experience doing something similar. > " > I've written an app that needs to be "integrated" into a "portal". Drupal was > chosen. However, Drupal starts the session and I use Zend_Session in the ZF > app. > > 1. I could hack Drupal to use Zend_Session. > 2. Or is it possible to overide Zend_Session to use the Drupal API calls? > 3. Or do I use the Drupal session API calls directly in my ZF app? > > I don't really want to do 3, because then the app will be tied directly too > Drupal. This is no so nice if management decides to change horses - we know > how they do. ;) > > I've done this before with CMSMS. However, CMSMS did not need sessions. > > I guess the real question is, can I extend Zend_Session_Abstract and use that > class instead? > > It seems possible, and it seems like that would be the neatest way of re- > writing my ZF app to work with Drupal. > > Has anyone done anything like this before that can comment?
Zend_Session in the ZF1 tree is not terribly portable, for many of the same reasons that the Drupal session API doesn't work well: it makes the assumption that you are using it to manage $_SESSION, and nothing else is. (I've completely re-written Zend_Session for ZF2.) While you *could* extend it, I'd check and see if you can simply manipulate $_SESSION directly. If so, you'll keep it tied only to the PHP ext/session API, which will allow you to use the code outside of Drupal later if you desire. Depending on how you're writing your code, I'd write a helper of some sort to "start" the session -- this would call the Drupal session API's methods for initializing the session. You could later rewrite the helper to call something else (or make it configurable, so that it can call different session initialization routines based on environment). -- Matthew Weier O'Phinney Project Lead | [email protected] Zend Framework | http://framework.zend.com/ PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
