Part of the EllisLab Network
   
 
CI Session Library + CI Active Record + Doctrine => No joy
Posted: 03 February 2009 01:36 PM   [ Ignore ]  
Grad Student
Rank
Total Posts:  47
Joined  03-14-2007

In my project to integrate Doctrine with CI (readme: WC, SVN) I found two disturbing things.

First is the fact that the Session class totally depends on the Active Record class being enabled and that the availability of the class is not even checked. I think that even if the next point isn’t fixed the availability of the AR should at least be checked and the dependency noted in the documentation and class file.

The second point is that the use of the database is hard coded into the class. And thus it’s not pluggable. It might be a nice idea to implement a modular data storage for the session class to make it less dependable on the CI AR. This would be particularly nice to get rid of the CI database layer at all to use only Doctrine.

What is your opinion about this?

Profile
 
 
Posted: 03 February 2009 05:35 PM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  378
Joined  09-11-2006

What does removing Active Record buy you, really? Perhaps a degree of sanity knowing that your database calls are all going through a single path, but a really bad future developer could always just use the built-in PHP SQL functions, so I don’t see that argument as particularly weighty.

A few months ago, I whipped up a Doctrine plugin than operates alongside Active Record. You can use any of the built-in CI libraries and can upgrade your CI version without breaking anything, while still gaining all the power of Doctrine.

If you’re looking for a framework with a built-in ORM, that’s also a lot like CodeIgniter, check out Kohana.

[Drop-in PHP Doctrine plugin]

 Signature 

August 2011: I’m not an active codeigniter developer right now. Feel free to contact me, but I may not be able to solve your problem for you.

flickr | twitter | rockets

Profile
 
 
Posted: 03 February 2009 07:16 PM   [ Ignore ]   [ # 2 ]  
Grad Student
Rank
Total Posts:  47
Joined  03-14-2007

Why? It eliminates the necessity of loading a heavyweight to do just do a plain thing. I write software to be correct, and maintain a reasonably high standard. Just loading an extra heavy library because the developers of a framework didn’t think of making things modular opposes me.
The argument that a bad future developer could always use the built-in php sql functions is a no-brainer, and bad developers don’t get in my team. So I don’t worry about those.

It looks that your plugin does the same as my hook and cli file combined.

I know about Kohana, but I like(d) to bring something good to CodeIgniter. Why should I suddenly change software?

Profile
 
 
Posted: 04 February 2009 05:13 AM   [ Ignore ]   [ # 3 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  535
Joined  03-13-2008

just install the native sessions library (I seem to be saying this a lot lately!) find it on the wiki.
I really don’t like the way the default CI sessions work.

 Signature 

:wq

Profile