views:

950

answers:

6

As the question says it all.

Which framework in PHP is most closely cloned to ActiveRecord (Ruby on Rail).

I have gone through many frameworks claiming to be based on ActiveRecord ideology but unfortunately none really come any close to ActiveRecord. Wny?

Are there any such frameworks that I have missed?

A: 

There is a project called php-activerecord (beta): http://www.derivante.com/2009/05/19/php-activerecord-available-for-beta-testing/

Florian
+4  A: 

I think you're slightly confused. ActiveRecord itself isn't really a framework; Rails is the framework, ActiveRecord is the object-relational mapper (ORM, or database abstraction layer, if you prefer).

That said, CakePHP is probably the PHP framework with the most similarities to Rails, in general.

But either way, why not just use Rails? You won't be able to get anything like Rails on PHP.

musicfreak
Thanks for correcting me.I mean RoR with ActiveRecord.
Yogi Yang 007
+2  A: 

If you are looking for a ORM package then Propel is quite nice.

PHP has a little bit of trouble implementing the Active Record pattern. Because of a shortcoming with its handling of static methods and inheritance you can't (easily) implement a Person::findByPrimary(1) style static method.

Instead most PHP ORM's use a Table Data Gateway pattern and have separate classes for table opperations PersonHelper->findByPrimary(1); and row actions new Person()->save().

Josh
+2  A: 

I would say the most stable and up-to-date project resembling RoR is PhpOnTrax

soulmerge
I this is the closest PHP can get to RoR and Active Record.Thanks for this.
Yogi Yang 007
is this framework stable and has good support from community ?
nightingale2k1
A: 

It is worth nothing that since the release of PHP 5.3, late static binding has opened the doors to the kinds of reflection necessary to implement ActiveRecord on PHP!

Omega